Skip to content

Commit

Permalink
airscan-trace.c: Check the path length
Browse files Browse the repository at this point in the history
GCC 11 with -Werror generates an error for 'strcpy' usage,
so checking the size and returning NULL if lesser than 4
works it around.
  • Loading branch information
zdohnal committed Apr 16, 2021
1 parent 8e8ea91 commit 0b9be6d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions airscan-trace.c
Expand Up @@ -110,6 +110,9 @@ trace_open (const char *device_name)
path = str_append(path, ".log");
t->log = fopen(path, "w");

// work around gcc 11 warning
log_assert(NULL, str_len(path) >= 4);

strcpy(path + str_len(path) - 4, ".tar");
t->data = fopen(path, "wb");

Expand Down

0 comments on commit 0b9be6d

Please sign in to comment.