Fix mismatched free and strcpy overlap

This commit is contained in:
emanuele-f 2018-10-18 15:18:44 +02:00
parent e0d6c1ee98
commit 94040cc0d9
3 changed files with 11 additions and 7 deletions

View file

@ -630,7 +630,11 @@ static void authorize(struct mg_connection *conn,
/* Referer url must begin with '/' */
if((referer[0] != '/') || (strcmp(referer, AUTHORIZE_URL) == 0)) {
char *r = strchr(referer, '/');
strcpy(referer, r ? r : "/");
if(r)
memmove(referer, r, strlen(r)+1 /* with null terminator */);
else
strcpy(referer, "/");
}
/* Send session cookie and set user for the new session */