Thread (26 messages) 26 messages, 2 authors, 2017-11-09
STALE3168d

[PATCH 02/23] ndef: Fix use of uninitialized variable in property_get_type()

From: Mark Greer <mgreer@animalcreek.com>
Date: 2017-06-15 18:25:24
Subsystem: the rest · Maintainer: Linus Torvalds

The 'type' variable in property_get_type() is never set when the
record type is invalid.  This means that the check for NULL doesn't
work as it should and a bogus string can be appended.  Fix this by
adding a default case to the switch statement that checks the record
type ensuring that 'type' is set to NULL when the record type is
invalid.

Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
 src/ndef.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/src/ndef.c b/src/ndef.c
index b90205b..99f3bc3 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -342,6 +342,7 @@ static gboolean property_get_type(const GDBusPropertyTable *property,
 	case RECORD_TYPE_WKT_ERROR:
 	case RECORD_TYPE_UNKNOWN:
 	case RECORD_TYPE_ERROR:
+	default:
 		type = NULL;
 		break;
 
-- 
2.13.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help