Add NULL pointer guards for the crash reports variables
Calling sprintf with NULL string for a %s format identifier seems to be undefined behavior. I got some semi persistent crashes while calling the extend options menu with mO.
This commit is contained in:
@@ -1235,7 +1235,8 @@ optfn_crash_email(int optidx UNUSED, int req, boolean negated UNUSED, char *opts
|
||||
if (req == get_val || req == get_cnf_val) {
|
||||
if (!opts)
|
||||
return optn_err;
|
||||
Sprintf(opts, "%s", gc.crash_email);
|
||||
if (gc.crash_email)
|
||||
Sprintf(opts, "%s", gc.crash_email);
|
||||
return optn_ok;
|
||||
}
|
||||
return optn_ok;
|
||||
@@ -1258,7 +1259,8 @@ optfn_crash_name(int optidx UNUSED, int req, boolean negated UNUSED, char *opts,
|
||||
if (req == get_val || req == get_cnf_val) {
|
||||
if (!opts)
|
||||
return optn_err;
|
||||
Sprintf(opts, "%s", gc.crash_name);
|
||||
if (gc.crash_name)
|
||||
Sprintf(opts, "%s", gc.crash_name);
|
||||
return optn_ok;
|
||||
}
|
||||
return optn_ok;
|
||||
|
||||
Reference in New Issue
Block a user