iprep: fix parsing ip-rep data with carriage return

Commit e7c0f0ad91 removed uses of atoi with a new number parsing
functions. This broke parsing ip-reputation data files that contained
trailing carriage returns as it was being included in the number
string to convert.

Bug: #6243.
pull/9426/head
Thomas Winter 3 years ago
parent becb8cefcc
commit a284f01c1d

@ -282,7 +282,8 @@ static int SRepSplitLine(SRepCIDRTree *cidr_ctx, char *line, Address *ip, uint8_
char *origline = line;
while (i < (int)line_len) {
if (line[i] == ',' || line[i] == '\n' || line[i] == '\0' || i == (int)(line_len - 1)) {
if (line[i] == ',' || line[i] == '\n' || line[i] == '\r' || line[i] == '\0' ||
i == (int)(line_len - 1)) {
line[i] = '\0';
ptrs[idx] = line;

Loading…
Cancel
Save