Make sure the resutl from readlink is properly null terminated
This commit is contained in:
parent
7899e2f42d
commit
de1b2d143a
1 changed files with 2 additions and 1 deletions
|
@ -186,7 +186,8 @@ int linux_br_get(char *brname, const char *ifname)
|
|||
char path[128], brlink[128], *pos;
|
||||
os_snprintf(path, sizeof(path), "/sys/class/net/%s/brport/bridge",
|
||||
ifname);
|
||||
if (readlink(path, brlink, sizeof(brlink)) < 0)
|
||||
os_memset(brlink, 0, sizeof(brlink));
|
||||
if (readlink(path, brlink, sizeof(brlink) - 1) < 0)
|
||||
return -1;
|
||||
pos = os_strrchr(brlink, '/');
|
||||
if (pos == NULL)
|
||||
|
|
Loading…
Reference in a new issue