Explorar el Código

Patch from Luc Van Oostenryck to fix a buffer overflow
in getlogin_r

Eric Andersen hace 21 años
padre
commit
944d7f249b
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      libc/unistd/getlogin.c

+ 1 - 1
libc/unistd/getlogin.c

@@ -42,7 +42,7 @@ int getlogin_r(char *name, size_t len)
 		return -1;
 
 	strncpy(name, foo, len);
-	name[len] = '\0';
+	name[len-1] = '\0';
 	return 0;
 }