Freshclam, Sigtool, Clamconf: fix database line count if has empty lines

Fixes: https://github.com/Cisco-Talos/clamav/issues/1390
This commit is contained in:
Micah Snyder 2024-10-30 17:45:36 -04:00
parent 52b201762f
commit 2e544984f0
No known key found for this signature in database
GPG key ID: 3449E631914956D0

View file

@ -479,7 +479,15 @@ unsigned int countlines(const char *filename)
return 0;
while (fgets(buff, sizeof(buff), fh)) {
// ignore comments
if (buff[0] == '#') continue;
// ignore empty lines in CR/LF format
if (buff[0] == '\r' && buff[1] == '\n') continue;
// ignore empty lines in LF format
if (buff[0] == '\n') continue;
lines++;
}