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

[PATCH] svn_wc_get_switch_editor() and svn_wc_get_update_editor() have some memory bugs

From: Kouhei Sutou <kou_at_cozmixng.org>
Date: 2005-03-21 16:07:44 CET

svn_wc_get_switch_editor() and svn_wc_get_update_editor()
doesn't allocate a memory for svn_wc__compat_notify_baton_t
although it's needed.

---
Allocate a memory for svn_wc__compat_notify_baton_t which is
not temporally used.
* subversion/libsvn_wc/update_editor.c
  (svn_wc_get_update_editor)
  (svn_wc_get_switch_editor): Allocate a memory.
---

Index: subversion/libsvn_wc/update_editor.c
===================================================================
--- subversion/libsvn_wc/update_editor.c (revision 13554)
+++ subversion/libsvn_wc/update_editor.c (working copy)
@@ -2561,11 +2561,13 @@
                           svn_wc_traversal_info_t *traversal_info,
                           apr_pool_t *pool)
 {
- svn_wc__compat_notify_baton_t nb = { notify_func, notify_baton };
-
+ svn_wc__compat_notify_baton_t *nb = apr_palloc (pool, sizeof (*nb));
+ nb->func = notify_func;
+ nb->baton = notify_baton;
+
   return svn_wc_get_update_editor2 (target_revision, anchor, target,
                                     use_commit_times, recurse,
- svn_wc__compat_call_notify_func, &nb,
+ svn_wc__compat_call_notify_func, nb,
                                     cancel_func, cancel_baton, diff3_cmd,
                                     editor, edit_baton, traversal_info, pool);
 }
@@ -2612,11 +2614,13 @@
                           svn_wc_traversal_info_t *traversal_info,
                           apr_pool_t *pool)
 {
- svn_wc__compat_notify_baton_t nb = { notify_func, notify_baton };
+ svn_wc__compat_notify_baton_t *nb = apr_palloc (pool, sizeof (*nb));
+ nb->func = notify_func;
+ nb->baton = notify_baton;
 
   return svn_wc_get_switch_editor2 (target_revision, anchor, target,
                                     switch_url, use_commit_times, recurse,
- svn_wc__compat_call_notify_func, &nb,
+ svn_wc__compat_call_notify_func, nb,
                                     cancel_func, cancel_baton, diff3_cmd,
                                     editor, edit_baton, traversal_info, pool);
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Mar 21 16:31:58 2005

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.