jpage8580/GTUltra

Build warnings and buffer overflow

lunadog opened this issue · 1 comments

Building under Linux Mint (6.8.0-45-generic kernel), I am getting a lot of errors after typing Make -

cc sdl2-config --cflags pkg-config --cflags alsa -Ibme -Iasm -O3 -Wall -c -o goatdata.o goatdata.c
cc sdl2-config --cflags pkg-config --cflags alsa -Ibme -Iasm -O3 -Wall -c -o gt2stereo.o gt2stereo.c
gt2stereo.c: In function ‘waitkeymouse’:
gt2stereo.c:1197:81: warning: format not a string literal and no format arguments [-Wformat-security]
1197 | sprintf(infoTextBuffer, keyOffsetText);
| ^~~~~~~~~~~~~
gt2stereo.c:1204:65: warning: format not a string literal and no format arguments [-Wformat-security]
1204 | sprintf(infoTextBuffer, keyOffsetText);
| ^~~~~~~~~~~~~
gt2stereo.c: In function ‘main’:
gt2stereo.c:583:41: warning: ignoring return value of ‘chdir’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
583 | chdir(startpath);
| ^~~~~~~~~~~~~~~~
gt2stereo.c: In function ‘getparam’:
gt2stereo.c:2779:17: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
2779 | fgets(configbuf, MAX_PATHNAME, handle);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gt2stereo.c: In function ‘getfloatparam’:
gt2stereo.c:2831:17: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
2831 | fgets(configbuf, MAX_PATHNAME, handle);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gt2stereo.c: In function ‘getstringparam’:
gt2stereo.c:2854:17: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]

.. etc

and although the binary builds, when I try to run gtultra, I get

*** buffer overflow detected ***: terminated
Aborted (core dumped)

Note - this is fixed by pull request #73