mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Use strndup(3) instead of malloc + memcpy
This commit is contained in:
parent
2d23488dac
commit
5c8e56f615
1 changed files with 2 additions and 3 deletions
|
|
@ -351,9 +351,8 @@ read_excludes_file(char *file)
|
|||
while ((buf = fgetln(fp, &len)) != NULL) {
|
||||
if (buf[len - 1] == '\n')
|
||||
len--;
|
||||
pattern = xmalloc(len + 1);
|
||||
memcpy(pattern, buf, len);
|
||||
pattern[len] = '\0';
|
||||
if ((pattern = strndup(buf, len)) == NULL)
|
||||
err(2, "xstrndup");
|
||||
push_excludes(pattern);
|
||||
}
|
||||
if (strcmp(file, "-") != 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue