After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 408423 - Crash when replying to an appointment
Crash when replying to an appointment
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Calendar
2.10.x (obsolete)
Other Linux
: High critical
: ---
Assigned To: evolution-calendar-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2007-02-15 23:10 UTC by Daniel Gryniewicz
Modified: 2013-09-13 00:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix (1.64 KB, patch)
2007-02-15 23:11 UTC, Daniel Gryniewicz
none Details | Review
Alternate patch (3.79 KB, patch)
2007-04-01 07:44 UTC, Matthew Barnes
committed Details | Review

Description Daniel Gryniewicz 2007-02-15 23:10:20 UTC
When an appointment has a long title (or any other string that goes into the email) there is a buffer overflow when constructing the email when replying.  This is because fixed-sized buffers are allocated for things like the subject of the email.  Attached is a patch that changes these to variable sized based on the data actually being written.  Patch is against 2.9.91, but applies unchanged to 2.8.3 (which also has the problem).  Backtrace from the crash is:

(gdb) bt
  • #0 raise
    from /lib/libc.so.6
  • #1 abort
    from /lib/libc.so.6
  • #2 ??
    from /lib/libc.so.6
  • #3 ??
    from /lib/libc.so.6
  • #4 free
    from /lib/libc.so.6
  • #5 reply_to_calendar_comp
    at itip-utils.c line 1489
  • #6 on_reply
    at e-calendar-view.c line 1531
  • #7 ep_activate
    at e-popup.c line 304
  • #8 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #9 ??
    from /usr/lib/libgobject-2.0.so.0
  • #10 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #11 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #12 gtk_widget_activate
    from /usr/lib/libgtk-x11-2.0.so.0
  • #13 gtk_menu_shell_activate_item
    from /usr/lib/libgtk-x11-2.0.so.0
  • #14 ??
    from /usr/lib/libgtk-x11-2.0.so.0
  • #15 ??
    from /usr/lib/libgtk-x11-2.0.so.0
  • #16 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #17 ??
    from /usr/lib/libgobject-2.0.so.0
  • #18 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #19 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #20 ??
    from /usr/lib/libgtk-x11-2.0.so.0
  • #21 gtk_propagate_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #22 gtk_main_do_event
    from /usr/lib/libgtk-x11-2.0.so.0
  • #23 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #24 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #25 ??
    from /usr/lib/libglib-2.0.so.0
  • #26 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #27 bonobo_main
    from /usr/lib/libbonobo-2.so.0
  • #28 main
    at main.c line 614
$1 = 0xf78700 "<tr><td><b>Subject</b></td><td>:</td><td>Updated: Multi-controller coordinated channel FS review</td></tr>"

Note the string is 107 characters long, but the buffer is only 100.
Comment 1 Daniel Gryniewicz 2007-02-15 23:11:34 UTC
Created attachment 82642 [details] [review]
Proposed fix

Proposed fix: use the length of the actual strings being written to calculate the size of the buffer to create.  Each buffer is the size of the fix string + 1 + strlen of the string to write.
Comment 2 Srinivasa Ragavan 2007-02-27 05:38:50 UTC
Harish/Chen: Ping.
Comment 3 Matthew Barnes 2007-04-01 07:44:42 UTC
Created attachment 85636 [details] [review]
Alternate patch

The above patch is correct but I think it's easier and less error-prone to just use a GString to build the HTML content.  Also, this function is leaking memory like crazy.  For starters, g_strconcat() returns a newly-allocated string.  So each "body = g_strconcat (body, ...)" is leaking the former contents of 'body'.

Here's an alternate patch that uses GString and cleans up several memory leaks.
Comment 4 Srinivasa Ragavan 2007-04-06 18:38:31 UTC
Great ! Please commit.
Comment 5 Matthew Barnes 2007-04-07 03:28:23 UTC
Committed to Subversion trunk (revision 33397).