diff options
author | otto <otto@openbsd.org> | 2019-06-04 15:45:58 +0000 |
---|---|---|
committer | otto <otto@openbsd.org> | 2019-06-04 15:45:58 +0000 |
commit | 9cf8b5257fe09bfcff0581eaf3c86ffab933ba4d (patch) | |
tree | 73ff1a9c372afe86b7791599efbaaf047f35a349 /sbin/ttyflags | |
parent | Let SP kernel work with WITNESS. The necessary instrumentation was (diff) | |
download | wireguard-openbsd-9cf8b5257fe09bfcff0581eaf3c86ffab933ba4d.tar.xz wireguard-openbsd-9cf8b5257fe09bfcff0581eaf3c86ffab933ba4d.zip |
Do nog segfault on malformed ttys(5) entry; ok kn@ jca@
Diffstat (limited to 'sbin/ttyflags')
-rw-r--r-- | sbin/ttyflags/ttyflags.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/ttyflags/ttyflags.c b/sbin/ttyflags/ttyflags.c index 01aa3ee145f..ceb323d299d 100644 --- a/sbin/ttyflags/ttyflags.c +++ b/sbin/ttyflags/ttyflags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttyflags.c,v 1.14 2019/01/13 23:40:30 deraadt Exp $ */ +/* $OpenBSD: ttyflags.c,v 1.15 2019/06/04 15:45:58 otto Exp $ */ /* $NetBSD: ttyflags.c,v 1.8 1996/04/09 05:20:30 cgd Exp $ */ /* @@ -114,7 +114,8 @@ all(int print) rval = 0; for (tep = getttyent(); tep != NULL; tep = getttyent()) { /* pseudo-tty ignore TIOCSFLAGS, so don't bother */ - if (strcmp(tep->ty_type, "network") == 0) + if (tep->ty_type == NULL || + strcmp(tep->ty_type, "network") == 0) continue; if (ttyflags(tep, print)) rval = 1; |