* objcopy.c (add_redefine_syms_file): Avoid symbol buffer
overrun.
This commit is contained in:
parent
0ee19663b7
commit
a6da20b52c
2 changed files with 9 additions and 3 deletions
|
@ -1232,7 +1232,7 @@ add_redefine_syms_file (const char *filename)
|
|||
filename, strerror (errno));
|
||||
|
||||
bufsize = 100;
|
||||
buf = (char *) xmalloc (bufsize);
|
||||
buf = (char *) xmalloc (bufsize + 1 /* For the terminating NUL. */);
|
||||
|
||||
lineno = 1;
|
||||
c = getc (file);
|
||||
|
@ -1249,7 +1249,7 @@ add_redefine_syms_file (const char *filename)
|
|||
if (len >= bufsize)
|
||||
{
|
||||
bufsize *= 2;
|
||||
buf = (char *) xrealloc (buf, bufsize);
|
||||
buf = (char *) xrealloc (buf, bufsize + 1);
|
||||
}
|
||||
c = getc (file);
|
||||
}
|
||||
|
@ -1275,7 +1275,7 @@ add_redefine_syms_file (const char *filename)
|
|||
if (len >= bufsize)
|
||||
{
|
||||
bufsize *= 2;
|
||||
buf = (char *) xrealloc (buf, bufsize);
|
||||
buf = (char *) xrealloc (buf, bufsize + 1);
|
||||
}
|
||||
c = getc (file);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue