taviso / 123elf

A native port of Lotus 1-2-3 to Linux.
1.18k stars 59 forks source link

Fix segfault with option "-b" #39

Closed jserv closed 2 years ago

jserv commented 2 years ago

GDB Traces:

Program received signal SIGSEGV, Segmentation fault. hide_option_from_lotus (argc=0xffffd2a0, argv=0xffffd334) at main.c:18 warning: Source file is more recent than executable. 18 if (argv[optind][0] != '-' || argv[optind][2] != '\0') { (gdb) p optind $1 = 2 (gdb) p argv[optind] $2 = 0x0

taviso commented 2 years ago

Oops - I thought I was being clever rewriting the argv logic to not need malloc, thanks for catching that!

taviso commented 2 years ago

Ah, I realize the problem - I should have decremented optind first, so I'm comparing the wrong parameter. Oops.

Btw - I removed the -f unix code because I realized it can be set in l123set.cf (the 1008 line).