[asterisk-bugs] [JIRA] (ASTERISK-30235) res_crypto and tests: Memory issues and and uninitialized variable error

George Joseph (JIRA) noreply at issues.asterisk.org
Fri Sep 16 09:56:11 CDT 2022


George Joseph created ASTERISK-30235:
----------------------------------------

             Summary: res_crypto and tests:  Memory issues and and uninitialized variable error
                 Key: ASTERISK-30235
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30235
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Resources/res_crypto
    Affects Versions: 20.0.0, 19.7.0, 18.15.0, 16.29.0
            Reporter: George Joseph


When compiled with optimization...

{code}
test_crypto.c: In function ‘hexstring.constprop’:
test_crypto.c:60:16: error: function returns address of local variable [-Werror=return-local-addr]
   60 |         return buf;
      |                ^~~
In file included from /usr/include/stdlib.h:574,
                 from /usr/src/asterisk/asterisk/include/asterisk/compat.h:41,
                 from /usr/src/asterisk/asterisk/include/asterisk.h:22,
                 from test_crypto.c:33:
test_crypto.c:52:21: note: declared here
   52 |         char *buf = alloca(datalen * 2 + 1);

test.c: In function ‘ast_test_capture_command’:
test.c:114:15: error: ‘out’ may be used uninitialized [-Werror=maybe-uninitialized]
  114 |         ({ if (fp != NULL) { \
      |               ^
test.c:382:36: note: ‘out’ was declared here
  382 |                 FILE *cmd = NULL, *out = NULL, *err = NULL;
      |                                    ^~~
{code}

In res_crypto try_load_key(), the returned "buf" is never freed.




--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list