Skip to content

Commit

Permalink
Concat temp file suffix without strcat
Browse files Browse the repository at this point in the history
  • Loading branch information
vaishalikumanan committed Aug 9, 2021
1 parent 25f91ea commit 53565c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ static bool spawn_process(struct pss_tty *pss, uint16_t columns, uint16_t rows)
}
else if (server->arg_file != NULL) {
int fd = -1;
char *filePath = strcat(server->arg_file, "XXXXXX");
char *filePath = xmalloc(strlen(server->arg_file) + 7);
sprintf(filePath, "%sXXXXXX", server->arg_file);

if ((fd = mkstemp(filePath)) == -1) {
lwsl_err("Creation of temp file failed with error: %d (%s)\n", errno, strerror(errno));
Expand Down

0 comments on commit 53565c7

Please sign in to comment.