Skip to content

Commit

Permalink
replace malloc/strcpy pair with strdup to allocate correct size
Browse files Browse the repository at this point in the history
  • Loading branch information
sauyon authored and d3m3vilurr committed Apr 11, 2019
1 parent aedcc25 commit 79e63a8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions libgamestream/xml.c
Expand Up @@ -118,11 +118,8 @@ static void XMLCALL _xml_start_status_element(void *userData, const char *name,
for (int i = 0; atts[i]; i += 2) {
if (strcmp("status_code", atts[i]) == 0)
*status = atoi(atts[i + 1]);
else if (*status != STATUS_OK && strcmp("status_message", atts[i]) == 0) {
gs_error = malloc(strlen(atts[i + 1]));
if (gs_error)
strcpy((char*) gs_error, atts[i + 1]);
}
else if (*status != STATUS_OK && strcmp("status_message", atts[i]) == 0)
gs_error = strdup(atts[i + 1]);
}
}
}
Expand Down

0 comments on commit 79e63a8

Please sign in to comment.