projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] Potential overflow and unused variable
[fio.git]
/
init.c
diff --git
a/init.c
b/init.c
index 2cfa6d286544421dfd033bd9fecdb94890fa3d0b..732cceb993755a7ac2c5b6f3672c13c5950664b8 100644
(file)
--- a/
init.c
+++ b/
init.c
@@
-843,7
+843,7
@@
int parse_jobs_ini(char *file, int stonewall_flag)
{
unsigned int global;
struct thread_data *td;
{
unsigned int global;
struct thread_data *td;
- char *string, *name
, *tmpbuf
;
+ char *string, *name;
fpos_t off;
FILE *f;
char *p;
fpos_t off;
FILE *f;
char *p;
@@
-857,7
+857,7
@@
int parse_jobs_ini(char *file, int stonewall_flag)
string = malloc(4096);
name = malloc(256);
string = malloc(4096);
name = malloc(256);
-
tmpbuf = malloc(409
6);
+
memset(name, 0, 25
6);
stonewall = stonewall_flag;
while ((p = fgets(string, 4096, f)) != NULL) {
stonewall = stonewall_flag;
while ((p = fgets(string, 4096, f)) != NULL) {
@@
-865,7
+865,7
@@
int parse_jobs_ini(char *file, int stonewall_flag)
break;
if (is_empty_or_comment(p))
continue;
break;
if (is_empty_or_comment(p))
continue;
- if (sscanf(p, "[%s]", name) != 1)
+ if (sscanf(p, "[%
255
s]", name) != 1)
continue;
global = !strncmp(name, "global", 6);
continue;
global = !strncmp(name, "global", 6);
@@
-916,7
+916,6
@@
int parse_jobs_ini(char *file, int stonewall_flag)
free(string);
free(name);
free(string);
free(name);
- free(tmpbuf);
fclose(f);
return ret;
}
fclose(f);
return ret;
}