diff mbox

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

Message ID 20170615182516.4508-3-mgreer@animalcreek.com (mailing list archive)
State Accepted
Delegated to: Samuel Ortiz
Headers show

Commit Message

Mark Greer June 15, 2017, 6:24 p.m. UTC
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 mbox

Patch

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;