+Sun Dec 7 00:05:28 1997 Tom Yu <tlyu@mit.edu>
+
+ * getpty.c (pty_getpty): Fix goof in previous, which introduced
+ another fencepost error.
+
Thu Dec 4 21:48:12 1997 Tom Yu <tlyu@mit.edu>
* getpty.c (pty_getpty): Fix checks on string lengths to account
} else {
for (cp = "pqrstuvwxyzPQRST";*cp; cp++) {
sprintf(slavebuf,"/dev/ptyXX");
- slavebuf[sizeof("/dev/pty")] = *cp;
- slavebuf[sizeof("/dev/ptyp")] = '0';
+ slavebuf[sizeof("/dev/pty") - 1] = *cp;
+ slavebuf[sizeof("/dev/ptyp") - 1] = '0';
if (stat(slavebuf, &stb) < 0)
break;
for (i = 0; i < 16; i++) {
if (*fd < 0) continue;
/* got pty */
- slavebuf[strlen("/dev/")] = 't';
+ slavebuf[sizeof("/dev/") - 1] = 't';
if (strlen(slavebuf) > slavelength -1) {
close(*fd);
*fd = -1;