diff options
author | Philipp Kloke <philipp.kloke@web.de> | 2013-03-31 12:03:47 +0200 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2013-04-01 02:16:58 +0400 |
commit | efe66c65d183417cfc5a8ea6ae344b69fa29d897 (patch) | |
tree | 833c1279e4452c9e2f2c1ceb4f72ce55eeab3564 /rdoff | |
parent | dae212d049b1c6f737f14fe5c904adb6da432d8c (diff) | |
download | nasm-efe66c65d183417cfc5a8ea6ae344b69fa29d897.tar.gz nasm-efe66c65d183417cfc5a8ea6ae344b69fa29d897.tar.bz2 nasm-efe66c65d183417cfc5a8ea6ae344b69fa29d897.zip |
Fixed three possible buffer overflows
Bug found by: CppCheck 1.59 (static source analysis tool)
Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'rdoff')
-rw-r--r-- | rdoff/rdlib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rdoff/rdlib.c b/rdoff/rdlib.c index 838f140..038b6fc 100644 --- a/rdoff/rdlib.c +++ b/rdoff/rdlib.c @@ -78,7 +78,7 @@ int rdl_verify(const char *filename) while (!feof(fp)) { i = 0; - while (fread(buf + i, 1, 1, fp) == 1 && buf[i] && i < 257) + while (fread(buf + i, 1, 1, fp) == 1 && i < 257 && buf[i]) i++; if (feof(fp)) break; @@ -162,7 +162,7 @@ int rdl_searchlib(struct librarynode *lib, const char *label, rdffile * f) i = strlen(lib->name); buf[i++] = '.'; t = i; - while (fread(buf + i, 1, 1, lib->fp) == 1 && buf[i] && i < 512) + while (fread(buf + i, 1, 1, lib->fp) == 1 && i < 512 && buf[i]) i++; buf[i] = 0; @@ -239,7 +239,7 @@ int rdl_openmodule(struct librarynode *lib, int moduleno, rdffile * f) i = strlen(buf); buf[i++] = '.'; t = i; - while (fread(buf + i, 1, 1, lib->fp) == 1 && buf[i] && i < 512) + while (fread(buf + i, 1, 1, lib->fp) == 1 && i < 512 && buf[i]) i++; buf[i] = 0; if (feof(lib->fp)) |