diff options
-rw-r--r-- | src/svf/svf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/svf/svf.c b/src/svf/svf.c index 69f75ac..3e7bfbf 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -642,8 +642,9 @@ static int svf_read_command_from_file(FILE *fd) * - added space. * - terminating NUL ('\0') */ - if ((cmd_pos + 2) >= svf_command_buffer_size) { - svf_command_buffer = realloc(svf_command_buffer, (cmd_pos + 2)); + if (cmd_pos + 3 > svf_command_buffer_size) { + svf_command_buffer = realloc(svf_command_buffer, cmd_pos + 3); + svf_command_buffer_size = cmd_pos + 3; if (svf_command_buffer == NULL) { LOG_ERROR("not enough memory"); return ERROR_FAIL; |