Skip to content
Snippets Groups Projects
Commit 2a2c6ed4 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix insufficient 'mode' string length in init() method

Limited to 6 chars, yet some values are as long as 12 chars.

Also, eliminates this warning from RELEASE builds (only) using gcc version
12.2.0 (Debian 12.2.0-14):
js_uifc.c: In function ‘js_uifc_init’:
sbbs.h:230:56: warning: writing 8 bytes into a region of size 7 [-Wstringop-overflow=]
  230 |                                         (ret)[JSSTSpos]=(char)JSSTSstrval[JSSTSpos]; \
      |                                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sbbs.h:242:9: note: in expansion of macro ‘JSSTRING_TO_ASTRING’
  242 |         JSSTRING_TO_ASTRING((cx), JSVTSstr, (ret), (maxsize), (lenptr)); \
      |         ^~~~~~~~~~~~~~~~~~~
js_uifc.c:609:17: note: in expansion of macro ‘JSVALUE_TO_ASTRING’
  609 |                 JSVALUE_TO_ASTRING(cx, argv[1], mode, 7, NULL);
      |                 ^~~~~~~~~~~~~~~~~~
In file included from sbbs.h:255:
/home/rswindell/sbbs/src/sbbs3/../xpdev/genwrap.h:77:20: note: destination object of size 7 allocated by ‘__builtin_alloca’
   77 | #define alloca(sz) __builtin_alloca(sz)
      |                    ^~~~~~~~~~~~~~~~~~~~
sbbs.h:228:43: note: in expansion of macro ‘alloca’
  228 |                         if(((ret)=(char *)alloca((*JSSTSlenptr)+1))) { \
      |                                           ^~~~~~
sbbs.h:242:9: note: in expansion of macro ‘JSSTRING_TO_ASTRING’
  242 |         JSSTRING_TO_ASTRING((cx), JSVTSstr, (ret), (maxsize), (lenptr)); \
      |         ^~~~~~~~~~~~~~~~~~~
js_uifc.c:609:17: note: in expansion of macro ‘JSVALUE_TO_ASTRING’
  609 |                 JSVALUE_TO_ASTRING(cx, argv[1], mode, 7, NULL);
      |                 ^~~~~~~~~~~~~~~~~~
parent 1945c6d3
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -606,7 +606,7 @@ js_uifc_init(JSContext *cx, uintN argc, jsval *arglist) ...@@ -606,7 +606,7 @@ js_uifc_init(JSContext *cx, uintN argc, jsval *arglist)
return(JS_TRUE); return(JS_TRUE);
} }
if(argc>1) { if(argc>1) {
JSVALUE_TO_ASTRING(cx, argv[1], mode, 7, NULL); JSVALUE_TO_ASTRING(cx, argv[1], mode, 16, NULL);
if(mode != NULL) { if(mode != NULL) {
if(!stricmp(mode,"STDIO")) if(!stricmp(mode,"STDIO"))
ciolib_mode=-1; ciolib_mode=-1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment