Summary:ASTERISK-27903: menuselect: GCC 8: restrict-qualified parameter passed and aliased.
Reporter:Alexander Traud (traud)Labels:
Date Opened:2018-06-07 07:44:17Date Closed:2018-06-20 10:34:58
Versions:13.21.0 15.4.0 Frequency of
Environment:GCC 8.1Attachments:
Description:This is a follow-up to ASTERISK-27824. In Fedora 28, the compiler GCC 8.1.1 gives:{code}menuselect_curses.c: In function 'display_mem_info':
menuselect_curses.c:230:12: warning: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Wrestrict]
   sprintf(buf, "%s%*.*s%s", buf, new_line ? 0 : 1, new_line ? 0 : 1, " ", word);
           ^~~               ~~~{code}This is because [man sprintf|http://manpages.ubuntu.com/manpages/bionic/man3/sprintf.3.html], section Note:{quote}Some programs imprudently rely on code such as the following

        sprintf(buf, "%s some further text", buf);

to append text to buf.  However, the standards explicitly note that the results are undefined if source and destination buffers overlap when calling sprintf(), snprintf(), vsprintf(), and vsnprintf().{quote}Thanks to [dcb314|https://github.com/dyne/frei0r/issues/22] for documenting this. Hopefully, someone is going to fix this.

Warnings in Menuselect do not get to an Error even with Developer Mode enabled. Furthermore, I do not use that piece of code, normally. So it does not block me personally.
Comments:By: Asterisk Team (asteriskteam) 2018-06-07 07:44:18.604-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Friendly Automation (friendly-automation) 2018-06-20 10:34:59.137-0500

Change 9201 merged by Jenkins2:
menuselect/menuselect_curses: Resolves sprintf usage error


By: Friendly Automation (friendly-automation) 2018-06-20 15:30:14.046-0500

Change 9202 merged by Jenkins2:
menuselect/menuselect_curses: Resolves sprintf usage error


By: Friendly Automation (friendly-automation) 2018-06-21 04:25:55.475-0500

Change 9191 merged by Joshua Colp:
menuselect/menuselect_curses: Resolves sprintf usage error