From 4876d62b5652129066a3470b035c405513ddf12c Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Thu, 4 Dec 2014 00:28:38 -0500 Subject: [PATCH] Copy the string into masterPassword because the line is getting free'd. --- MasterPassword/C/mpw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MasterPassword/C/mpw.c b/MasterPassword/C/mpw.c index 3eff6f1e..4963f27a 100644 --- a/MasterPassword/C/mpw.c +++ b/MasterPassword/C/mpw.c @@ -203,7 +203,7 @@ int main(int argc, char *const argv[]) { while ((linelen = getline(&line, &linecap, mpwConfig)) > 0) { char *lineData = line; if (strcmp(strsep(&lineData, ":"), userName) == 0) { - masterPassword = strsep(&lineData, "\n"); + masterPassword = strcpy(malloc(strlen(lineData)), strsep(&lineData, "\n")); break; } }