]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
cfgfile: handle missing command line option values
authorStefan Reinauer <stefan.reinauer@coreboot.org>
Wed, 17 Jun 2026 14:30:16 +0000 (07:30 -0700)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Wed, 17 Jun 2026 19:27:31 +0000 (12:27 -0700)
parse_cmdline_option() keeps unknown command line options in the
all_lines list. A trailing option such as -G reaches this path without
a value, which passed NULL to my_strdup() and crashed before the GUI
could start.

Store an empty string when no value is present so argument-less
options can still be represented in the saved option list.

cfgfile.cpp

index d676dc65d74f9ca26e49cf9c03636d67d7df1036..3a6f72c9bb5a75284bdbec39ccb93cce1f6f7cb8 100644 (file)
@@ -7754,7 +7754,7 @@ int parse_cmdline_option (struct uae_prefs *p, TCHAR c, const TCHAR *arg)
        u->option = xmalloc (TCHAR, 2);
        u->option[0] = c;
        u->option[1] = 0;
-       u->value = my_strdup (arg);
+       u->value = my_strdup (arg ? arg : _T(""));
        u->next = p->all_lines;
        p->all_lines = u;