aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Schwehr <schwehr@gmail.com>2018-05-31 02:07:30 -0700
committerKristian Evers <kristianevers@gmail.com>2018-05-31 11:07:30 +0200
commitbbb13e808b89bfaf544441b0e7f9b3bae48993bd (patch)
tree4037395a68573edba4ced59d907b2dfbb8eb5a3e
parent1b3c79bad58d0b85980d428b1d75f9651392a4d3 (diff)
downloadPROJ-bbb13e808b89bfaf544441b0e7f9b3bae48993bd.tar.gz
PROJ-bbb13e808b89bfaf544441b0e7f9b3bae48993bd.zip
Fix buffer overflow in gie.c:append_args() (#1023)
Observed a buffer overflow in append_args with autofuzz with the strcpy in append_args. I think the +2 is required to account for both a nul char and the space.
-rw-r--r--src/gie.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gie.c b/src/gie.c
index 1e362181..ab09dc14 100644
--- a/src/gie.c
+++ b/src/gie.c
@@ -1422,7 +1422,8 @@ static int append_args (ffio *G) {
if (tag)
skip_chars = strlen (tag);
- if (G->args_size < args_len + next_len - skip_chars + 1) {
+ /* +2: 1 for the space separator and 1 for the NUL termination. */
+ if (G->args_size < args_len + next_len - skip_chars + 2) {
void *p = realloc (G->args, 2 * G->args_size);
if (0==p)
return 0;