]> git.ipfire.org Git - thirdparty/suricata.git/commit
lua/flowvarlib: check malloc result
authorVictor Julien <vjulien@oisf.net>
Sat, 3 May 2025 08:20:54 +0000 (10:20 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 5 May 2025 19:41:02 +0000 (21:41 +0200)
commit223c5687017bf7d794e23d7619f44099da64c38f
tree3611eb266ed836561e3b16dfc2b576e6fbce6b2d
parent4e2f1de308aa2898ffc092176769f4ff0e74e203
lua/flowvarlib: check malloc result

src/util-lua-flowvarlib.c:110:12: warning: If memory allocation fails, then there is a possible null pointer dereference: buf [nullPointerOutOfMemory]
    memcpy(buf, value, len);
           ^
src/util-lua-flowvarlib.c:109:28: note: Assuming allocation function fails
    uint8_t *buf = SCMalloc(len + 1);
                           ^
src/util-lua-flowvarlib.c:109:28: note: Assignment 'buf=malloc(len+1)', assigned value is 0
    uint8_t *buf = SCMalloc(len + 1);
                           ^
src/util-lua-flowvarlib.c:110:12: note: Null pointer dereference
    memcpy(buf, value, len);
           ^
src/util-lua-flowvarlib.c:111:5: warning: If memory allocation fails, then there is a possible null pointer dereference: buf [nullPointerOutOfMemory]
    buf[len] = '\0';
    ^
src/util-lua-flowvarlib.c:109:28: note: Assuming allocation function fails
    uint8_t *buf = SCMalloc(len + 1);
                           ^
src/util-lua-flowvarlib.c:109:28: note: Assignment 'buf=malloc(len+1)', assigned value is 0
    uint8_t *buf = SCMalloc(len + 1);
                           ^
src/util-lua-flowvarlib.c:111:5: note: Null pointer dereference
    buf[len] = '\0';
src/util-lua-flowvarlib.c