Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line arguments not working on Linux? #69

Open
3vi1 opened this issue Oct 28, 2024 · 2 comments
Open

Command line arguments not working on Linux? #69

3vi1 opened this issue Oct 28, 2024 · 2 comments

Comments

@3vi1
Copy link

3vi1 commented Oct 28, 2024

I've tried to start RetroDebugger with various command line options to load a PRG file (ex.: "retrodebugger -c64 build/test.prg", "retrodebugger -c64 -prg build/test.prg", "retrodebugger -prg build/test.prg", etc.). RD starts without error, but it never loads the PRG.

I can load the same PRG fine if I load it from the menus after startup.

BTW: Testing just "retrodebugger build/test.prg" on Linux results in "*** buffer overflow detected ***: terminated". This is using the latest retrodebugger compiled from source on Linux - which seems to work fine in every other way.

Is there just some simple formatting thing that I'm missing?

@3vi1
Copy link
Author

3vi1 commented Nov 3, 2024

I did a little debugging into the buffer overflow that occurs when trying to start RetroDebugger with a single .prg path parameter:

On my system, it aborts when parsing the avahi process. proc_find_other_instance gets to line 222 and ends up thinking the fileName should be "avahi-daemon:" since it's not a real path in the command. This leads to MTEngineSDL's SYS_Funct/SYS_GetFileNameWithExtensionFromFullPath trying to do a strcpy (line 346) of the filename to a return buffer.

It looks like there wouldn't be room for the null terminating character since the array was created to be the exact length of the string - causing the buffer overflow.

@3vi1
Copy link
Author

3vi1 commented Nov 3, 2024

Confirmed. I added a +1 to the length declaration and I can now load from the command line. I'll fork and submit a pull request, if that works for you.

slajerek/MTEngineSDL#8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant