aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Greer <mgreer@animalcreek.com>2017-02-16 17:08:50 +0000
committerSamuel Ortiz <sameo@linux.intel.com>2017-11-10 00:15:10 +0100
commit047b0dff62ba02a619901fc24317a5dc6745dc24 (patch)
treecac653d62baf6ff873d1957c71e811cfe0b09bdd
parent7afe8460dce3275da71fa2ac8aa338deb373df34 (diff)
downloadneard-047b0dff62ba02a619901fc24317a5dc6745dc24.tar.gz
ndef: Fix use of uninitialized variable in property_get_type()
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>
-rw-r--r--src/ndef.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/ndef.c b/src/ndef.c
index 2775bac..d172dbc 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;