Skip to content
Permalink
Browse files
lasieve4e: initialize 'ret' to avoid undefined behavior
gnfs-lasieve4e.c: In function ‘main’:
gnfs-lasieve4e.c:2987:11: warning: ‘ret’ may be used uninitialized in this function

if resume file is zero bytes, ret will be used uninitialized because
fgets will return NULL the first time it's called.  Intended behavior
is to continue without it, so start out with ret = 0.
  • Loading branch information
radii committed Apr 23, 2011
1 parent 4562af0 commit 3490572ca8671635a1b8d13a28aef3e34a657fc7
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/lasieve4/gnfs-lasieve4e.c
@@ -2984,7 +2984,7 @@ int main(int argc, char **argv)

if (g_resume != 0) {
char buf[LINE_BUF_SIZE];
int ret;
int ret = 0;

if (zip_output != 0)
complain("Cannot resume gzipped file. gunzip, and retry without -z\n");

0 comments on commit 3490572

Please sign in to comment.