diff --git a/ChangeLog b/ChangeLog index 0173b592c2..7a68b94ee6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Mar 13 20:58:11 2009 Tanaka Akira + + * dln.c (dln_find_1): compare fspace in size_t world. + Fri Mar 13 18:58:04 2009 Nobuyoshi Nakada * configure.in (CFLAGS, CXXFLAGS): moved after warnflags. diff --git a/dln.c b/dln.c index b63cbc7140..023df69016 100644 --- a/dln.c +++ b/dln.c @@ -1616,8 +1616,9 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size, home = getenv("HOME"); if (home != NULL) { i = strlen(home); - if ((fspace -= i) < 0) + if (fspace < i) goto toolong; + fspace -= i; memcpy(bp, home, i); bp += i; } @@ -1625,8 +1626,9 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size, l--; } if (l > 0) { - if ((fspace -= l) < 0) + if (fspace < l) goto toolong; + fspace -= l; memcpy(bp, dp, l); bp += l; } @@ -1638,7 +1640,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size, /* now append the file name */ i = strlen(fname); - if ((fspace -= i) < 0) { + if (fspace < i) { toolong: fprintf(stderr, "openpath: pathname too long (ignored)\n"); *bp = '\0'; @@ -1646,6 +1648,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size, fprintf(stderr, "\tFile \"%s\"\n", fname); goto next; } + fspace -= i; memcpy(bp, fname, i + 1); #if defined(DOSISH)