From: Uwe Hermann Date: Sat, 2 May 2015 19:10:21 +0000 (+0200) Subject: Fix a potential segfault in sp_get_config_*(). X-Git-Tag: libserialport-0.1.1~42 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6aad5bdd474f7d41e06ba4dc094f7db50f0f94cd;p=libserialport.git Fix a potential segfault in sp_get_config_*(). --- diff --git a/serialport.c b/serialport.c index 80527be..f2d2edc 100644 --- a/serialport.c +++ b/serialport.c @@ -2117,6 +2117,8 @@ SP_API enum sp_return sp_set_##x(struct sp_port *port, type x) { \ SP_API enum sp_return sp_get_config_##x(const struct sp_port_config *config, \ type *x) { \ TRACE("%p, %p", config, x); \ + if (!x) \ + RETURN_ERROR(SP_ERR_ARG, "Null result pointer"); \ if (!config) \ RETURN_ERROR(SP_ERR_ARG, "Null config"); \ *x = config->x; \