Loading...
--- Libc/Libc-1725.40.4/stdlib/grantpt.c
+++ Libc/Libc-1669.0.4/stdlib/grantpt.c
@@ -23,15 +23,13 @@
#include <os/assumes.h>
#include <os/once_private.h>
-
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
/*
* posix_openpt call for cloning pty implementation.
@@ -125,10 +123,14 @@
return -1;
}
- if (strlcpy(buffer, ptsnamebuf, buflen) >= buflen) {
+ size_t len = strlen(ptsnamebuf) + 1;
+ if (buflen < len) {
errno = ERANGE;
return -1;
}
+
+ memcpy(buffer, ptsnamebuf, len);
+
return 0;
}