[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] initialize struct members

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Wed, 10 Sep 2008 19:19:32 +0200

Hi,

Before I commit this, maybe someone likes to first review it:
this patch initializes all struct members in the functions
svn_wc_conflict_description_create_text() and
svn_wc_conflict_description_create_prop().
Found this due to crashes in TSVN - it tried to access the merged_file
member which had a non-NULL value but pointed to bogus memory.

If nobody objects, I'll commit this in about an hour (shouldn't be much
to object to IMHO).

Stefan

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.net

[[[
Initialize all struct members
* subversion/libsvn_wc/util.c
  (svn_wc_conflict_description_create_text),
  (svn_wc_conflict_description_create_prop): initialize all members
]]]
Index: subversion/libsvn_wc/util.c
===================================================================
--- subversion/libsvn_wc/util.c (revision 33012)
+++ subversion/libsvn_wc/util.c (working copy)
@@ -306,6 +306,13 @@
   conflict->access = adm_access;
   conflict->action = svn_wc_conflict_action_edit;
   conflict->reason = svn_wc_conflict_reason_edited;
+
+ conflict->base_file = NULL;
+ conflict->merged_file = NULL;
+ conflict->my_file = NULL;
+ conflict->their_file = NULL;
+ conflict->property_name = NULL;
+ conflict->mime_type = NULL;
   return conflict;
 }
 
@@ -324,5 +331,14 @@
   conflict->kind = svn_wc_conflict_kind_property;
   conflict->access = adm_access;
   conflict->property_name = property_name;
+
+ conflict->action = svn_wc_conflict_action_edit;
+ conflict->reason = svn_wc_conflict_reason_edited;
+ conflict->base_file = NULL;
+ conflict->merged_file = NULL;
+ conflict->my_file = NULL;
+ conflict->their_file = NULL;
+ conflict->property_name = NULL;
+ conflict->mime_type = NULL;
   return conflict;
 }

Received on 2008-09-10 19:19:59 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.