Avoid undefined memory access
This commit is contained in:
parent
0e3138d5fa
commit
fa50a090f7
@ -1304,7 +1304,7 @@ static int _queue_push_do(Hayes * hayes, HayesChannel * channel)
|
|||||||
HayesCommand * command;
|
HayesCommand * command;
|
||||||
char const * prefix = "";
|
char const * prefix = "";
|
||||||
char const * attention;
|
char const * attention;
|
||||||
const char suffix[2] = "\r\n";
|
const char suffix[] = "\r\n";
|
||||||
size_t size;
|
size_t size;
|
||||||
char * p;
|
char * p;
|
||||||
guint timeout;
|
guint timeout;
|
||||||
@ -1328,7 +1328,7 @@ static int _queue_push_do(Hayes * hayes, HayesChannel * channel)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s() pushing \"%s\"\n", __func__, attention);
|
fprintf(stderr, "DEBUG: %s() pushing \"%s\"\n", __func__, attention);
|
||||||
#endif
|
#endif
|
||||||
size = strlen(prefix) + strlen(attention) + sizeof(suffix);
|
size = strlen(prefix) + strlen(attention) + sizeof(suffix) - 1;
|
||||||
if((p = realloc(channel->wr_buf, channel->wr_buf_cnt + size)) == NULL)
|
if((p = realloc(channel->wr_buf, channel->wr_buf_cnt + size)) == NULL)
|
||||||
{
|
{
|
||||||
hayes_command_set_status(command, HCS_ERROR);
|
hayes_command_set_status(command, HCS_ERROR);
|
||||||
|
Loading…
Reference in New Issue
Block a user