Skip to content

Commit

Permalink
Initialize the respone buffer to 0
Browse files Browse the repository at this point in the history
Some of the code paths check if *response == NULL and if we end up at
the end main without anything actually setting the response we might
be printing random stack memory.

Found by static code checker: "line 135: Potentially uninitialized buffer 'response' used. Consider checking the first actual argument of the 'strlen' function."
  • Loading branch information
Gabriel Kihlman committed Mar 18, 2019
1 parent 2314cb7 commit 7f16739
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/u2f-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ main (int argc, char *argv[])
struct gengetopt_args_info args_info;
char challenge[BUFSIZ];
size_t chal_len;
char response[2048];
char response[2048] = {0};
size_t response_len = sizeof (response);
u2fh_devs *devs = NULL;
u2fh_cmdflags flags = 0;
Expand Down

0 comments on commit 7f16739

Please sign in to comment.