1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-03 21:16:45 +02:00

cleanup: fix some uninitialized memory warnings and clarify some logic

This commit is contained in:
jfreegman
2021-12-13 12:33:52 -05:00
parent bf1e1b73fc
commit 3f18c6f8de
5 changed files with 27 additions and 23 deletions

View File

@ -108,14 +108,15 @@ static int load_nameserver_list(const char *path)
char line[MAX_SERVER_LINE];
while (fgets(line, sizeof(line), fp) && Nameservers.lines < MAX_SERVERS) {
int linelen = strlen(line);
size_t linelen = strlen(line);
if (linelen < SERVER_KEY_SIZE * 2 + 5) {
continue;
}
if (line[linelen - 1] == '\n') {
line[--linelen] = '\0';
--linelen;
line[linelen] = '\0';
}
const char *name = strtok(line, " ");