diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-13 12:00:04 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-13 12:00:04 +0000 |
commit | 783e3705e1bbe27d78086a131a2d443528a43dbc (patch) | |
tree | e16832b11aff6b5cb32cbc40d98f5003c9bac547 | |
parent | 441ca997c9c48ac4e2e89c012cb6b522c822b8c0 (diff) | |
download | ruby-783e3705e1bbe27d78086a131a2d443528a43dbc.tar.gz ruby-783e3705e1bbe27d78086a131a2d443528a43dbc.tar.xz ruby-783e3705e1bbe27d78086a131a2d443528a43dbc.zip |
* dln.c (dln_find_1): compare fspace in size_t world.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | dln.c | 9 |
2 files changed, 10 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Fri Mar 13 20:58:11 2009 Tanaka Akira <akr@fsij.org> + + * dln.c (dln_find_1): compare fspace in size_t world. + Fri Mar 13 18:58:04 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * configure.in (CFLAGS, CXXFLAGS): moved after warnflags. @@ -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) |