Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146031011
D37265.id112607.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
682 B
Referenced Files
None
Subscribers
None
D37265.id112607.diff
View Options
diff --git a/libexec/getty/main.c b/libexec/getty/main.c
--- a/libexec/getty/main.c
+++ b/libexec/getty/main.c
@@ -212,9 +212,14 @@
* that the file descriptors are already set up for us.
* J. Gettys - MIT Project Athena.
*/
- if (argc <= 2 || strcmp(argv[2], "-") == 0)
- snprintf(ttyn, sizeof(ttyn), "%s", ttyname(STDIN_FILENO));
- else {
+ if (argc <= 2 || strcmp(argv[2], "-") == 0) {
+ char *n = ttyname(STDIN_FILENO);
+ if (n == NULL) {
+ syslog(LOG_ERR, "ttyname: %m");
+ exit(1);
+ }
+ snprintf(ttyn, sizeof(ttyn), "%s", n);
+ } else {
snprintf(ttyn, sizeof(ttyn), "%s%s", _PATH_DEV, argv[2]);
if (strcmp(argv[0], "+") != 0) {
chown(ttyn, 0, 0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 28, 5:03 AM (15 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29053569
Default Alt Text
D37265.id112607.diff (682 B)
Attached To
Mode
D37265: getty: Avoid NULL deref if stdin is not a tty.
Attached
Detach File
Event Timeline
Log In to Comment