Browse Source

Make sure the resutl from readlink is properly null terminated

Jouni Malinen 15 years ago
parent
commit
de1b2d143a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/drivers/linux_ioctl.c

+ 2 - 1
src/drivers/linux_ioctl.c

@@ -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)