diff options
author | jbj <devnull@localhost> | 2001-08-03 05:04:13 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-08-03 05:04:13 +0000 |
commit | 46d2e8bbd870dce29f43af7c67f50c97754975bd (patch) | |
tree | 1a1ad64eabae563bf1f3eee476deaca93de94f24 /lib/header.c | |
parent | 1a5a027bcc8071a3b50f726bf8a3e93cd770ef1d (diff) | |
download | rpm-46d2e8bbd870dce29f43af7c67f50c97754975bd.tar.gz rpm-46d2e8bbd870dce29f43af7c67f50c97754975bd.tar.bz2 rpm-46d2e8bbd870dce29f43af7c67f50c97754975bd.zip |
- fix: i18n tags not terminated correctly with NUL (#50304).
- add explicit casts to work around a s390 compiler problem.
CVS patchset: 4998
CVS date: 2001/08/03 05:04:13
Diffstat (limited to 'lib/header.c')
-rw-r--r-- | lib/header.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/header.c b/lib/header.c index d8c4d43f7..aa5bba485 100644 --- a/lib/header.c +++ b/lib/header.c @@ -327,7 +327,9 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl, char * tprev = NULL; char * t = NULL; int tdel, tl = dl; + struct indexEntry ieprev; + memset(&ieprev, 0, sizeof(ieprev)); for (; il > 0; il--, pe++) { struct indexEntry ie; int_32 type; @@ -355,13 +357,16 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl, diff = typeSizes[type] - (dl % typeSizes[type]); if (diff != typeSizes[type]) { dl += diff; + if (ieprev.info.type == RPM_I18NSTRING_TYPE) + ieprev.length += diff; } } tdel = (tprev ? (t - tprev) : 0); - dl += ie.length; - tl += tdel; + if (ieprev.info.type == RPM_I18NSTRING_TYPE) + tdel = ieprev.length; + tprev = (ie.info.tag < HEADER_I18NTABLE) - ? dataStart : t; + ? (dataStart - REGION_TAG_COUNT) : t; /* Perform endian conversions */ switch (ntohl(pe->type)) { @@ -381,6 +386,11 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl, t += ie.length; break; } + + dl += ie.length; + tl += tdel; + ieprev = ie; /* structure assignment */ + } tdel = (tprev ? (t - tprev) : 0); tl += tdel; @@ -769,10 +779,8 @@ Header headerLoad(void * uh) /*@=assignexpose@*/ entry->length = pvlen - sizeof(il) - sizeof(dl); rdlen = regionSwab(entry+1, il, 0, pe, dataStart, entry->info.offset); -#if !defined(MANDRAKE_LOCALE_PACKAGE_DEBUG) if (rdlen != dl) goto errxit; -#endif entry->rdlen = rdlen; entry++; h->indexUsed++; @@ -1582,7 +1590,7 @@ int headerAddI18NString(Header h, int_32 tag, const char * string, const char * entry->data = xrealloc(entry->data, entry->length + length); memset(((char *)entry->data) + entry->length, '\0', ghosts); - memmove(((char *)entry->data) + entry->length + ghosts, string, strlen(string)); + strcpy(((char *)entry->data) + entry->length + ghosts, string); entry->length += length; entry->info.count = langNum + 1; |