소스 검색

"Kim B. Heino" <Kim.Heino@bluegiga.com> reports

	In the libc/stdlib/bsd_getpt.c file you have line:

	memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY) - 1);

	It really should be:

	memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY) );

	The last nul character must be copied too because the next line uses
	strlen() to get buf's length.
Eric Andersen 24 년 전
부모
커밋
a5b6b616f8
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      libc/stdlib/bsd_getpt.c

+ 1 - 1
libc/stdlib/bsd_getpt.c

@@ -48,7 +48,7 @@ __getpt (void)
   const char *p, *q;
   char *s;
 
-  memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY) - 1);
+  memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY));
   s = buf + strlen (buf);
 
   /* s[0] and s[1] will be filled in the loop.  */