]> sigrok.org Git - libserialport.git/commitdiff
Fix a potential segfault in sp_get_config_*().
authorUwe Hermann <redacted>
Sat, 2 May 2015 19:10:21 +0000 (21:10 +0200)
committerUwe Hermann <redacted>
Wed, 6 May 2015 15:06:06 +0000 (17:06 +0200)
serialport.c

index 80527be098a85eed8d624ce7ff8dd4e5dc594e12..f2d2edcd3b56349feb85e4116defe25f64201ceb 100644 (file)
@@ -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; \