From efe66c65d183417cfc5a8ea6ae344b69fa29d897 Mon Sep 17 00:00:00 2001 From: Philipp Kloke Date: Sun, 31 Mar 2013 12:03:47 +0200 Subject: Fixed three possible buffer overflows Bug found by: CppCheck 1.59 (static source analysis tool) Signed-off-by: Philipp Kloke Signed-off-by: Cyrill Gorcunov --- rdoff/rdlib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rdoff') 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)) -- cgit v1.2.3