diff options
author | Wim Taymans <wtaymans@redhat.com> | 2015-06-22 16:42:58 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2015-06-22 16:42:58 +0200 |
commit | 795699b28a99bc68e6a98e81d41f3cb3e8dd9b81 (patch) | |
tree | c898ba374b4b3dbd7fffec363ed7af771469bdf7 | |
parent | 4c81fbf198184e2ee986ac88d73ba81382bcff7a (diff) | |
download | orc-795699b28a99bc68e6a98e81d41f3cb3e8dd9b81.tar.gz |
parse: increase array size
Increase the size of the array to hold our variable name and use
snprintf to avoid overflows.
-rw-r--r-- | orc/orcparse.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/orc/orcparse.c b/orc/orcparse.c index 8d6be4c..f46b0be 100644 --- a/orc/orcparse.c +++ b/orc/orcparse.c @@ -307,7 +307,7 @@ orc_parse_full (const char *code, OrcProgram ***programs, char **log) for(i=offset+1,j=0;i<n_tokens;i++,j++){ char *end; double unused ORC_GNUC_UNUSED; - char varname[20]; + char varname[80]; args[j] = token[i]; @@ -316,7 +316,7 @@ orc_parse_full (const char *code, OrcProgram ***programs, char **log) int id; /* make a unique name based on value and size */ - sprintf (varname, "_%d.%s", opcode_arg_size(o, j), token[i]); + snprintf (varname, sizeof (varname), "_%d.%s", opcode_arg_size(o, j), token[i]); id = orc_program_add_constant_str (parser->program, opcode_arg_size(o, j), token[i], varname); /* it's possible we reused an existing variable, get its name so |