- 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
This commit is contained in:
jbj 2001-08-03 05:04:13 +00:00
parent 1a5a027bcc
commit 46d2e8bbd8
6 changed files with 21 additions and 10 deletions

View File

@ -200,6 +200,8 @@
- add support for mips (#49283).
- add __as, _build_arch, and __cxx macros (#36662, #36663, #49280).
- detailed build package error messages.
- fix: i18n tags not terminated correctly with NUL (#50304).
- add explicit casts to work around a s390 compiler problem.
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.

View File

@ -159,7 +159,7 @@ int_32 *const getBuildTime(void)
static int_32 buildTime[1];
if (buildTime[0] == 0)
buildTime[0] = time(NULL);
buildTime[0] = (int_32) time(NULL);
return buildTime;
}

View File

@ -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;

View File

@ -1670,7 +1670,7 @@ assert(psm->mi == NULL);
if (ts->transFlags & RPMTRANS_FLAG_TEST) break;
if (psm->goal == PSM_PKGINSTALL) {
int_32 installTime = time(NULL);
int_32 installTime = (int_32) time(NULL);
if (fi->fstates != NULL && fi->fc > 0)
(void) headerAddEntry(fi->h, RPMTAG_FILESTATES, RPM_CHAR_TYPE,

View File

@ -1558,7 +1558,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
ts->currDir = currentDirectory();
ts->chrootDone = 0;
if (ts->rpmdb) ts->rpmdb->db_chrootDone = 0;
ts->id = time(NULL);
ts->id = (int_32) time(NULL);
memset(psm, 0, sizeof(*psm));
/*@-assignexpose@*/

View File

@ -2451,6 +2451,7 @@ int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
if (iid != 0 && iid != -1) {
int_32 tid = iid;
(void) headerRemoveEntry(h, RPMTAG_REMOVETID);
if (!headerIsEntry(h, RPMTAG_INSTALLTID))
(void) headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1);
}