]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[test] Fix out of bound buffer read in switch_test
authorChris Rienzo <chris@signalwire.com>
Wed, 18 Mar 2020 15:26:04 +0000 (15:26 +0000)
committerAndrey Volk <andywolk@gmail.com>
Wed, 6 May 2020 22:58:30 +0000 (02:58 +0400)
src/include/test/switch_test.h

index b320e3fdca240d7f7549b982e00e2a9da4705704..d343ead1b26b3b24933c2b39168ecbd60026921e 100644 (file)
@@ -863,7 +863,7 @@ cJSON *varname = NULL; \
        int fd = open(file, O_RDONLY); \
        fst_requires(fd >= 0); \
        fstat(fd, &s); \
-       buf = malloc(s.st_size + 1); \
+       switch_zmalloc(buf, s.st_size + 1); \
        fst_requires(buf); \
        size = read(fd, buf, s.st_size); \
        fst_requires(size == s.st_size); \