diff --git a/vcgencmd/vcgencmd.c b/vcgencmd/vcgencmd.c index 63faf2e..15b54ce 100644 --- a/vcgencmd/vcgencmd.c +++ b/vcgencmd/vcgencmd.c @@ -98,7 +98,7 @@ static unsigned gencmd(int file_desc, const char *command, char *result, int res p[i++] = 0x00000000; // process request p[i++] = GET_GENCMD_RESULT; // (the tag id) - p[i++] = MAX_STRING;// buffer_len + p[i++] = MAX_STRING + 4; // buffer_len: response word + command/result p[i++] = 0; // request_len (set to response length) p[i++] = 0; // error repsonse @@ -110,7 +110,7 @@ static unsigned gencmd(int file_desc, const char *command, char *result, int res mbox_property(file_desc, p); result[0] = 0; - strncat(result, (const char *)(p+6), result_len); + strncat(result, (const char *)(p+6), result_len - 1); return p[5]; }