From 20af610683e4d7fc22deaa26e7b92730057405cd Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Fri, 2 Nov 2012 18:44:52 +0100 Subject: [PATCH] serial: Fix two segfaults. --- hardware/common/serial.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hardware/common/serial.c b/hardware/common/serial.c index d688f7d1..c39b2ca5 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -303,6 +303,11 @@ SR_PRIV int serial_restore_params(int fd, void *backup) { sr_dbg("FD %d: Restoring serial parameters from backup.", fd); + if (!backup) { + sr_err("FD %d: Cannot restore serial params (NULL).", fd); + return -1; + } + #ifdef _WIN32 /* TODO */ #else @@ -384,7 +389,7 @@ SR_PRIV int serial_set_params(int fd, int baudrate, int bits, int parity, sr_dbg("FD %d: Getting terminal settings.", fd); if (tcgetattr(fd, &term) < 0) { - sr_err("tcgetattr() error: %ѕ.", strerror(errno)); + sr_err("tcgetattr() error: %s.", strerror(errno)); return SR_ERR; }