diff --git a/cxmon/src/mon_cmd.cpp b/cxmon/src/mon_cmd.cpp index b708f034..4cb6a92b 100644 --- a/cxmon/src/mon_cmd.cpp +++ b/cxmon/src/mon_cmd.cpp @@ -21,6 +21,7 @@ #include "sysdeps.h" #include +#include #include "mon.h" #include "mon_cmd.h" @@ -84,11 +85,13 @@ start: if (mon_token == T_STRING) { unsigned n = strlen(mon_string); str = (uint8 *)realloc(str, (len + n - 1 + GRANULARITY) & ~(GRANULARITY - 1)); + assert(str != NULL); memcpy(str + len, mon_string, n); len += n; mon_get_token(); } else if (mon_expression(&value)) { str = (uint8 *)realloc(str, (len + GRANULARITY) & ~(GRANULARITY - 1)); + assert(str != NULL); str[len] = value; len++; } else {