OSDN Git Service

Patch from Luc Van Oostenryck to fix a buffer overflow
authorEric Andersen <andersen@codepoet.org>
Fri, 15 Nov 2002 09:25:16 +0000 (09:25 -0000)
committerEric Andersen <andersen@codepoet.org>
Fri, 15 Nov 2002 09:25:16 +0000 (09:25 -0000)
in getlogin_r

libc/unistd/getlogin.c

index c762c36..6db73ae 100644 (file)
@@ -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;
 }