init: Assign set value to avoid ambiguity 15/74615/1 accepted/tizen/common/20160627.191305 accepted/tizen/ivi/20160624.063530 accepted/tizen/mobile/20160624.063255 accepted/tizen/tv/20160624.063331 accepted/tizen/wearable/20160624.063424 submit/tizen/20160623.005438
authorsunm.lee <sunm.lee@samsung.com>
Wed, 15 Jun 2016 02:16:55 +0000 (11:16 +0900)
committersunm.lee <sunm.lee@samsung.com>
Wed, 15 Jun 2016 02:16:55 +0000 (11:16 +0900)
The set value of uid/euid is set by 0 only it was invalid.
To avoid access to uninitialized value of set after that,
set the set value in the valid case too.

Change-Id: Ia6add4eb382402f901314cb91f971234c3a73bfe
Signed-off-by: sunm.lee <sunm.lee@samsung.com>
src/init.c

index 76868cc..10cdc61 100644 (file)
@@ -159,6 +159,7 @@ static void foreignpw( struct reading *reading)
         snprintf( suid, sizeof suid, "%u", (unsigned)get_uid(reading->context));
         uid.id = suid;
         array[n++] = &uid;
+        uid.set = 1;
     }
     else {
         uid.set = 0;
@@ -180,6 +181,7 @@ static void foreignpw( struct reading *reading)
         snprintf( seuid, sizeof seuid, "%u", (unsigned)get_euid(reading->context));
         euid.id = seuid;
         array[n++] = &euid;
+        euid.set = 1;
     }
     else {
         euid.set = 0;