Skip to content
Snippets Groups Projects
Commit 9d69ec27 authored by swym's avatar swym
Browse files

card10.cfg: use strdup instead of memcpy for strings

parent 70dc340b
No related branches found
No related tags found
No related merge requests found
Pipeline #3595 passed
...@@ -70,7 +70,7 @@ subdir('ble/') ...@@ -70,7 +70,7 @@ subdir('ble/')
subdir('l0der/') subdir('l0der/')
epicardium_cargs = [] epicardium_cargs = ['-D_POSIX_C_SOURCE=200809']
if get_option('jailbreak_card10') if get_option('jailbreak_card10')
epicardium_cargs += [ epicardium_cargs += [
'-DJAILBREAK_CARD10=1', '-DJAILBREAK_CARD10=1',
......
...@@ -125,10 +125,7 @@ const char *elide(const char *str) ...@@ -125,10 +125,7 @@ const char *elide(const char *str)
static bool set_string(struct config_option *opt, const char *value) static bool set_string(struct config_option *opt, const char *value)
{ {
//this leaks, but the lifetime of these ends when epicardium exits, so... //this leaks, but the lifetime of these ends when epicardium exits, so...
size_t len = strlen(value); char *leaks = strdup(value);
char *leaks = (char *)malloc(len + 1);
strncpy(leaks, value, len);
leaks[len] = '\0';
opt->value.string = leaks; opt->value.string = leaks;
LOG_DEBUG("card10.cfg", "setting '%s' to %s", opt->name, elide(leaks)); LOG_DEBUG("card10.cfg", "setting '%s' to %s", opt->name, elide(leaks));
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment