diff options
Diffstat (limited to 'login-utils/checktty.c')
-rw-r--r-- | login-utils/checktty.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/login-utils/checktty.c b/login-utils/checktty.c index e5d03815a..f01d0ee82 100644 --- a/login-utils/checktty.c +++ b/login-utils/checktty.c @@ -3,8 +3,6 @@ Fixed by JDS June 1996 to clear lists and close files */ -#define _GNU_SOURCE /* for snprintf */ - #include <sys/types.h> #include <sys/param.h> @@ -143,7 +141,10 @@ isapty(const char *tty) char devname[100]; struct stat stb; - snprintf(devname, sizeof(devname), "/dev/%s", tty); + /* avoid snprintf - old systems do not have it */ + if (strlen(tty) + 6 > sizeof(devname)) + return 0; + sprintf(devname, "/dev/%s", tty); #if defined(__linux__) && defined(PTY_SLAVE_MAJOR) /* this is for linux 1.3 and newer */ |