when reading anchor key files.
+19 February 2025: Yorgos
+ - Fix static analysis report about unhandled EOF on error conditions
+ when reading anchor key files.
+
17 February 2025: Yorgos
- Consider reconfigurations when calculating the still_useful_timeout
for servers in the infrastructure cache.
if(txt_in[0] == 0 || txt_in[0] == '\n' || txt_in[0] == ';')
continue;
/* read check lines */
- if(!fgets(wire_chk, (int)bufs, chf))
+ if(!fgets(wire_chk, (int)bufs, chf)) {
printf("%s too short\n", check);
- if(!fgets(txt_chk, (int)bufs, chf))
+ unit_assert(0);
+ }
+ if(!fgets(txt_chk, (int)bufs, chf)) {
printf("%s too short\n", check);
+ unit_assert(0);
+ }
chlineno += 2;
if(vbmp) printf("%s:%d %s", check, chlineno-1, wire_chk);
if(vbmp) printf("%s:%d %s", check, chlineno, txt_chk);
/** skip file to end of line */
static void
-skip_to_eol(FILE* in)
+skip_to_eol(FILE* in, int *c)
{
- int c;
- while((c = getc(in)) != EOF ) {
- if(c == '\n')
+ while((*c = getc(in)) != EOF ) {
+ if(*c == '\n')
return;
}
}
int numdone = 0;
while((c = getc(in)) != EOF ) {
if(comments && c == '#') { /* # blabla */
- skip_to_eol(in);
+ skip_to_eol(in, &c);
+ if(c == EOF) return 0;
(*line)++;
continue;
} else if(comments && c=='/' && numdone>0 && /* /_/ bla*/
sldns_buffer_position(buf)-1) == '/') {
sldns_buffer_skip(buf, -1);
numdone--;
- skip_to_eol(in);
+ skip_to_eol(in, &c);
+ if(c == EOF) return 0;
(*line)++;
continue;
} else if(comments && c=='*' && numdone>0 && /* /_* bla *_/ */
if(c == '\n')
(*line)++;
}
+ if(c == EOF) return 0;
continue;
}
/* not a comment, complete the keyword */
break;
}
}
+ if(c == EOF) return 0;
return numdone;
}
if(is_bind_special(c))