meer icon indicating copy to clipboard operation
meer copied to clipboard

Probably copy & paste error resulting in Signal 6 when processing json

Open rueddldueddl opened this issue 5 years ago • 0 comments

gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I/opt/local/include -g -O2 -D__Darwin__ -MT meer-decode-json-alert.o -MD -MP -MF .deps/meer-decode-json-alert.Tpo -c -o meer-decode-json-alert.o test -f 'decode-json-alert.c' || echo './'decode-json-alert.c decode-json-alert.c:341:21: warning: '__builtin___strlcpy_chk' will always overflow destination buffer [-Wbuiltin-memcpy-chk-size] strlcpy(Alert_Return_Struct->alert_gid, (char *)json_object_get_string(tmp_alert), sizeof(Alert_Return_Struct->alert_action)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/secure/_string.h:108:3: note: expanded from macro 'strlcpy' __builtin___strlcpy_chk (dest, VA_ARGS, __darwin_obsz (dest)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated.

When building nonetheless and running meer, a Signal 6 will be thrown when processing the json. Line 341 in decode-json-alert.c should be: strlcpy(Alert_Return_Struct->alert_gid, (char *)json_object_get_string(tmp_alert), sizeof(Alert_Return_Struct-> alert_gid)); rather than: strlcpy(Alert_Return_Struct->alert_gid, (char *)json_object_get_string(tmp_alert), sizeof(Alert_Return_Struct->alert_action));

rueddldueddl avatar Oct 13 '20 12:10 rueddldueddl