From: Tom Yu Date: Wed, 3 Dec 1997 22:17:34 +0000 (+0000) Subject: * pty_err.et: Add PTY_OPEN_SLAVE_TOOSHORT error code X-Git-Tag: krb5-1.1-beta1~931 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5429bddbc0b8b4fcbcf0be6e3b7b47c44473c2ec;p=krb5.git * pty_err.et: Add PTY_OPEN_SLAVE_TOOSHORT error code * open_slave.c (pty_open_slave): Check to ensure that the slave name is not NULL or zero-length. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10310 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog index 6f8540f27..b25dc16e7 100644 --- a/src/util/pty/ChangeLog +++ b/src/util/pty/ChangeLog @@ -1,3 +1,10 @@ +Wed Dec 3 17:16:44 1997 Tom Yu + + * pty_err.et: Add PTY_OPEN_SLAVE_TOOSHORT error code. + + * open_slave.c (pty_open_slave): Check to ensure that the slave + name is not NULL or zero-length. + Tue Oct 28 13:28:54 1997 Ezra Peisach * pty-int.h: Do not prototype initialize_pty_error_table as diff --git a/src/util/pty/open_slave.c b/src/util/pty/open_slave.c index 05b83b809..7d28ea264 100644 --- a/src/util/pty/open_slave.c +++ b/src/util/pty/open_slave.c @@ -55,6 +55,8 @@ long pty_open_slave ( slave, fd) #endif + if (slave == NULL || *slave == '\0') + return PTY_OPEN_SLAVE_TOOSHORT; if (chmod(slave, 0)) return PTY_OPEN_SLAVE_CHMODFAIL; if ( chown(slave, 0, 0 ) == -1 ) diff --git a/src/util/pty/pty_err.et b/src/util/pty/pty_err.et index bcdecf4d2..08c126d62 100644 --- a/src/util/pty/pty_err.et +++ b/src/util/pty/pty_err.et @@ -21,7 +21,7 @@ error_table pty - error_code PTY_GETPTY_STREAMS, "Failed to unlock or grant streams pty." +error_code PTY_GETPTY_STREAMS, "Failed to unlock or grant streams pty." error_code PTY_GETPTY_FSTAT, "fstat of master pty failed" @@ -42,3 +42,4 @@ error_code PTY_OPEN_SLAVE_PUSH_FAIL, "Failed to push stream on slave side of pty error_code PTY_OPEN_SLAVE_REVOKEFAIL, "Failed to revoke slave side of pty" error_code PTY_UPDATE_UTMP_PROCTYPE_INVALID, "bad process type passed to pty_update_utmp" +error_code PTY_OPEN_SLAVE_TOOSHORT, "Slave pty name is zero-length"