From: Uwe Hermann Date: Fri, 2 Nov 2012 17:44:52 +0000 (+0100) Subject: serial: Fix two segfaults. X-Git-Tag: dsupstream~594 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=20af610683e4d7fc22deaa26e7b92730057405cd;p=libsigrok.git serial: Fix two segfaults. --- 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; }