[PATCH] server: initialize the _len parts to 0 (Coverity)

Marcus Meissner marcus at jet.franken.de
Sun Nov 30 06:50:04 CST 2014


There is always a path where new_sd.xxx_len could be uninitialized.

Initialize the 4 of them to 0 for safety reasons.

1243366 Uninitialized scalar variable
1243362 Explicit null dereferenced
1243361 Explicit null dereferenced
---
 server/object.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/server/object.c b/server/object.c
index ec196c1..bdb7cc3 100644
--- a/server/object.c
+++ b/server/object.c
@@ -436,6 +436,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
 
     new_sd.control = sd->control & ~SE_SELF_RELATIVE;
 
+    new_sd.owner_len = 0;
     if (set_info & OWNER_SECURITY_INFORMATION && sd->owner_len)
     {
         owner = sd_get_owner( sd );
@@ -452,6 +453,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
         new_sd.owner_len = security_sid_len( owner );
     }
 
+    new_sd.group_len = 0;
     if (set_info & GROUP_SECURITY_INFORMATION && sd->group_len)
     {
         group = sd_get_group( sd );
@@ -470,6 +472,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
 
     new_sd.control |= SE_SACL_PRESENT;
     sacl = sd_get_sacl( sd, &present );
+    new_sd.sacl_len = 0;
     if (set_info & SACL_SECURITY_INFORMATION && present)
         new_sd.sacl_len = sd->sacl_len;
     else
@@ -486,6 +489,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
 
     new_sd.control |= SE_DACL_PRESENT;
     dacl = sd_get_dacl( sd, &present );
+    new_sd.dacl_len = 0;
     if (set_info & DACL_SECURITY_INFORMATION && present)
         new_sd.dacl_len = sd->dacl_len;
     else
-- 
1.8.4.5




More information about the wine-patches mailing list