[Home]

Summary:ASTERISK-27578: [patch] app_osplookup.c: Avoid a format truncation.
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2018-01-12 04:21:03.000-0600Date Closed:2018-01-12 10:36:52.000-0600
Priority:TrivialRegression?
Status:Closed/CompleteComponents:Applications/app_osplookup
Versions:13.19.0 15.2.0 Frequency of
Occurrence
Related
Issues:
is related toASTERISK-27156 Asterisk won't compile on Fedora 26 with devmode enabled.
Environment:Attachments:( 0) truncation_gcc_osplookup.patch
Description:The compiler _GCC_ (7.2) reports:{code}app_osplookup.c: In function 'osplookup_exec':
app_osplookup.c:2584:42: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4078 [-Wformat-truncation=]
   snprintf(buffer, sizeof(buffer), "%s: %s", OSP_SIP_HEADER, results.token);
                                         ^~                   ~~~~~~~
app_osplookup.c: In function 'ospnext_exec':
app_osplookup.c:2770:42: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4078 [-Wformat-truncation=]
   snprintf(buffer, sizeof(buffer), "%s: %s", OSP_SIP_HEADER, results.token);
                                         ^~                   ~~~~~~~{code}ASTERISK-27156 tried to fix all warning reported by GCC 7.0 (and newer) but missed this module, because it depends on the package _libosptk-dev_, which is available only since Ubuntu 17.04, for example. Consequently, the above issue would emerge when going for script {{install_prereq}} on the upcoming Ubuntu 18.04 LTS.

For us external project members, covering the whole source code of Asterisk including all optional and conditional code is more than complicated. Perhaps one day, the Asterisk team is able to find a solution to identify issues with new compiler (versions) more systematically.
Comments:By: Friendly Automation (friendly-automation) 2018-01-12 10:36:53.364-0600

Change 7949 merged by Jenkins2:
app_osplookup.c: Avoid two format truncations.

[https://gerrit.asterisk.org/7949|https://gerrit.asterisk.org/7949]

By: Friendly Automation (friendly-automation) 2018-01-12 10:37:35.730-0600

Change 7948 merged by Jenkins2:
app_osplookup.c: Avoid two format truncations.

[https://gerrit.asterisk.org/7948|https://gerrit.asterisk.org/7948]

By: Friendly Automation (friendly-automation) 2018-01-12 10:37:37.572-0600

Change 7950 merged by Jenkins2:
app_osplookup.c: Avoid two format truncations.

[https://gerrit.asterisk.org/7950|https://gerrit.asterisk.org/7950]