celelibi at gmail.com
2015-Oct-13 04:18 UTC
[syslinux] [PATCH 1/1] ldlinux: Fix return pointer to local data
From: Sylvain Gault <sylvain.gault at gmail.com> The command-line parsing used to return a pointer to a local array. The code used to work by chance, but now, gcc 5 is able to detect it and return a NULL pointer instead. The buffer is now marked static. This shouldn't be a problem as only one command line can be read at a time. Signed-off-by: Sylvain Gault <sylvain.gault at gmail.com> --- com32/elflink/ldlinux/cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/elflink/ldlinux/cli.c b/com32/elflink/ldlinux/cli.c index 6ff30c6..3119b11 100644 --- a/com32/elflink/ldlinux/cli.c +++ b/com32/elflink/ldlinux/cli.c @@ -125,7 +125,7 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , int (*pDraw_Menu) (int, int, int), void (*show_fkey) (int), bool *timedout) { - char cmdline[MAX_CMDLINE_LEN] = { }; + static char cmdline[MAX_CMDLINE_LEN] = { }; int key, len, prev_len, cursor; int redraw = 0; int x, y; -- 2.6.1
poma
2015-Oct-16 13:40 UTC
[syslinux] [PATCH 1/1] ldlinux: Fix return pointer to local data
On 13.10.2015 06:18, celelibi--- via Syslinux wrote:> From: Sylvain Gault <sylvain.gault at gmail.com> > > The command-line parsing used to return a pointer to a local array. The > code used to work by chance, but now, gcc 5 is able to detect it and > return a NULL pointer instead. > > The buffer is now marked static. This shouldn't be a problem as only one > command line can be read at a time. > > Signed-off-by: Sylvain Gault <sylvain.gault at gmail.com> > --- > com32/elflink/ldlinux/cli.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/com32/elflink/ldlinux/cli.c b/com32/elflink/ldlinux/cli.c > index 6ff30c6..3119b11 100644 > --- a/com32/elflink/ldlinux/cli.c > +++ b/com32/elflink/ldlinux/cli.c > @@ -125,7 +125,7 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , > int (*pDraw_Menu) (int, int, int), > void (*show_fkey) (int), bool *timedout) > { > - char cmdline[MAX_CMDLINE_LEN] = { }; > + static char cmdline[MAX_CMDLINE_LEN] = { }; > int key, len, prev_len, cursor; > int redraw = 0; > int x, y; >Tested-by: poma <pomidorabelisima at gmail.com>
Paulo Alcantara
2015-Oct-18 16:10 UTC
[syslinux] [PATCH 1/1] ldlinux: Fix return pointer to local data
On Fri, 16 Oct 2015 15:40:44 +0200 poma via Syslinux <syslinux at zytor.com> wrote:> On 13.10.2015 06:18, celelibi--- via Syslinux wrote: > > From: Sylvain Gault <sylvain.gault at gmail.com> > > > > The command-line parsing used to return a pointer to a local array. > > The code used to work by chance, but now, gcc 5 is able to detect > > it and return a NULL pointer instead. > > > > The buffer is now marked static. This shouldn't be a problem as > > only one command line can be read at a time. > > > > Signed-off-by: Sylvain Gault <sylvain.gault at gmail.com> > > --- > > com32/elflink/ldlinux/cli.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/com32/elflink/ldlinux/cli.c > > b/com32/elflink/ldlinux/cli.c index 6ff30c6..3119b11 100644 > > --- a/com32/elflink/ldlinux/cli.c > > +++ b/com32/elflink/ldlinux/cli.c > > @@ -125,7 +125,7 @@ const char *edit_cmdline(const char *input, int > > top /*, int width */ , int (*pDraw_Menu) (int, int, int), > > void (*show_fkey) (int), bool *timedout) > > { > > - char cmdline[MAX_CMDLINE_LEN] = { }; > > + static char cmdline[MAX_CMDLINE_LEN] = { }; > > int key, len, prev_len, cursor; > > int redraw = 0; > > int x, y; > > > > > Tested-by: poma <pomidorabelisima at gmail.com>Thanks, applied. Paulo -- Paulo Alcantara, Hewlett-Packard Company Speaking for myself only.