[asterisk-bugs] [JIRA] (ASTERISK-27021) GET /recordings/stored returns 500 Internal Server Error

Tim Morgan (JIRA) noreply at issues.asterisk.org
Sun May 28 17:34:58 CDT 2017


Tim Morgan created ASTERISK-27021:
-------------------------------------

             Summary: GET /recordings/stored returns 500 Internal Server Error
                 Key: ASTERISK-27021
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27021
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Resources/res_ari_recordings
    Affects Versions: 14.4.0
         Environment: Asterisk 14.4, Centos 7
            Reporter: Tim Morgan
            Severity: Critical


Performing a GET on /recordings/stored fails, returning HTTP error code 500, Internal Server Error.

I determined that the problem is with this line:

    if (ast_asprintf(&filepath, "%s/%s", dir_name, filename) ) {
                return -1;
    }

in res/stasis_recording/stored.c, handle_scan_file().  Because ast_asprintf() returns a positive value when it is successful, this test incorrectly causes handle_scan_file to return -1.  I suspect it also causes a memory leak, since ast_asprintf() has successfully allocated some memory but it's believed to have failed.  After changing the test to:

    if (ast_asprintf(&filepath, "%s/%s", dir_name, filename) < 0) {

then "GET /recordings/stored" worked for me.

I haven't tried this GET operation with earlier versions, so I don't know when the problem was introduced.



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



More information about the asterisk-bugs mailing list