Skip to content

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

@rueddldueddl

Description

@rueddldueddl

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));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions