~ubuntu-branches/debian/sid/overkill/sid

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu_03_chat_buffer_overflow.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Joachim Breitner
  • Date: 2009-08-12 23:39:58 UTC
  • Revision ID: james.westby@ubuntu.com-20090812233958-ef3mc8mv58y79p93
Tags: 0.16-14
* Merged changes from Ubuntu, thanks for pushing them back (Closes: #540659)
   * Add dpatch patchsys:
    - debian/control: Add build-dependency on dpatch
    - debian/rules: Update for dpatch
    - Add debian/patches directory
  * Apply patches to fix four crashing bugs. All patches thanks to Jannich Brendle:
    - ubuntu_01_server_action_crash.dpatch: Patch to fix overkill-server crashes
      when anything happens in the game (LP: #406046)
    - ubuntu_02_overkill-test-server_segfault.dpatch: Patch to fix segfault in
      overkill-test-server due to invalid memory allocation (LP: #406000)
    - ubuntu_03_chat_buffer_overflow.dpatch: Patch to fix buffer overflow when
      sending chat messages over the specified limit (LP: #408557)
    - ubuntu_04_console.c_segfault.dpatch: Patch to fix overkill crashing on 
      startup due to the code trying to copy 16 bytes into a 8 byte array (LP: #297913)
* Remove obsolete build-dep on x-dev (Closes: #515386)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## ubuntu_03_chat_buffer_overflow.dpatch by David Futcher <bobbo@ubuntu.com>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: No description.
 
6
 
 
7
@DPATCH@
 
8
diff -urNad overkill-0.16~/client.c overkill-0.16/client.c
 
9
--- overkill-0.16~/client.c     2009-08-09 13:40:59.000000000 +0100
 
10
+++ overkill-0.16/client.c      2009-08-09 13:55:34.000000000 +0100
 
11
@@ -508,9 +508,16 @@
 
12
        int a;
 
13
 
 
14
        a=strlen(msg)+1;
 
15
-       packet[0]=P_MESSAGE;
 
16
-       memcpy(packet+1,msg,a);
 
17
-       send_packet(packet,a+1,(struct sockaddr *)(&server),my_id,0);
 
18
+       if(a<=MAX_MESSAGE_LENGTH) {
 
19
+               packet[0]=P_MESSAGE;
 
20
+               memcpy(packet+1,msg,a);
 
21
+               send_packet(packet,a+1,(struct sockaddr *)(&server),my_id,0);
 
22
+       } else {
 
23
+               packet[0]=P_MESSAGE;
 
24
+               memcpy(packet+1,msg,70);
 
25
+               send_packet(packet,a+1,(struct sockaddr *)(&server),my_id,0);
 
26
+               send_message(msg+70);
 
27
+       }
 
28
 }
 
29
 
 
30