From c413a43d5a127f9c5b7d7f5cc2df203a7f1734f3 Mon Sep 17 00:00:00 2001 From: Houman brinjcargorabi Date: Wed, 1 Jun 2016 14:42:37 +0100 Subject: [PATCH] mraa.c: Fixed logic error when deciding if the description is null Signed-off-by: Houman Brinjcargorabi Signed-off-by: Brendan Le Foll --- src/mraa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mraa.c b/src/mraa.c index e14f64b..867a45a 100644 --- a/src/mraa.c +++ b/src/mraa.c @@ -1132,10 +1132,13 @@ mraa_init_io(const char* desc) // max size is 4 + 1 for the \0 = 5 rounded to 8 char buffer[256] = { 0 }, type[8] = { 0 }; char *token = 0, *str = 0; + if (desc == NULL) { + return NULL; + } length = strlen(desc); // Check to see the length is less than or equal to 255 which means // byte 256 is supposed to be \0 - if (length > 255 || desc == NULL || length == 0) { + if (length > 255 || length == 0) { return NULL; } strncpy(buffer, desc, length);