[PATCH] libosmocore[master]: vty/vty.c: Check return value of tc{get, set}attr() calls

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Nov 26 09:24:22 UTC 2016


Review at  https://gerrit.osmocom.org/1298

vty/vty.c: Check return value of tc{get,set}attr() calls

Change-Id: I488ebf882ea12d5f9136563234c0da1018ea2ccd
Fixes: Coverity CID 57638
---
M src/vty/vty.c
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/98/1298/1

diff --git a/src/vty/vty.c b/src/vty/vty.c
index 88ed937..31e0a17 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -1489,10 +1489,15 @@
   struct vty *vty;
 
 	struct termios t;
+	int rc;
 
-	tcgetattr(vty_sock, &t);
+	rc = tcgetattr(vty_sock, &t);
+	if (rc < 0)
+		return NULL;
 	cfmakeraw(&t);
 	tcsetattr(vty_sock, TCSANOW, &t);
+	if (rc < 0)
+		return NULL;
 
   /* Allocate new vty structure and set up default values. */
   vty = vty_new ();

-- 
To view, visit https://gerrit.osmocom.org/1298
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I488ebf882ea12d5f9136563234c0da1018ea2ccd
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list