mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-06-20 21:32:56 +02:00
omhttpfs: fix insecure usage if strncmp()
consequences not evaluated as this is a contributed module. Detected by gcc 8.
This commit is contained in:
parent
56b8313f4a
commit
461d5e3a63
@ -424,22 +424,21 @@ httpfs_parse_exception(char* buf, int length, httpfs_json_remote_exception* jre)
|
|||||||
memset(jre, 0, sizeof(*jre));
|
memset(jre, 0, sizeof(*jre));
|
||||||
|
|
||||||
const char *str;
|
const char *str;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
json_object_object_get_ex(json, "javaClassName", &jobj);
|
json_object_object_get_ex(json, "javaClassName", &jobj);
|
||||||
str = json_object_get_string(jobj);
|
str = json_object_get_string(jobj);
|
||||||
len = strlen(str);
|
strncpy(jre->class, str, sizeof(jre->class));
|
||||||
strncpy(jre->class, str, len);
|
jre->class[sizeof(jre->class)-1] = '\0';
|
||||||
|
|
||||||
json_object_object_get_ex(json, "exception", &jobj);
|
json_object_object_get_ex(json, "exception", &jobj);
|
||||||
str = json_object_get_string(jobj);
|
str = json_object_get_string(jobj);
|
||||||
len = strlen(str);
|
strncpy(jre->exception, str, sizeof(jre->exception));
|
||||||
strncpy(jre->exception, str, len);
|
jre->exception[sizeof(jre->exception)-1] = '\0';
|
||||||
|
|
||||||
json_object_object_get_ex(json, "message", &jobj);
|
json_object_object_get_ex(json, "message", &jobj);
|
||||||
str = json_object_get_string(jobj);
|
str = json_object_get_string(jobj);
|
||||||
len = strlen(str);
|
strncpy(jre->message, str, sizeof(jre->message));
|
||||||
strncpy(jre->message, str, len);
|
jre->message[sizeof(jre->message)-1] = '\0';
|
||||||
|
|
||||||
finalize_it:
|
finalize_it:
|
||||||
if(jt != NULL)
|
if(jt != NULL)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user