/pidgin/main: 1a8a6a18e76e: Gadu-Gadu: fix protobuf-c undefined ...

Tomasz Wasilczyk twasilczyk at pidgin.im
Sun Oct 12 13:53:30 EDT 2014


Changeset: 1a8a6a18e76e001d1c2dd589c0f8aeaeacf02221
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-10-12 19:53 +0200
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/1a8a6a18e76e

Description:

Gadu-Gadu: fix protobuf-c undefined behaviour. Fixes #16327

diffstat:

 libpurple/protocols/gg/lib/protobuf-c.c |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (21 lines):

diff --git a/libpurple/protocols/gg/lib/protobuf-c.c b/libpurple/protocols/gg/lib/protobuf-c.c
--- a/libpurple/protocols/gg/lib/protobuf-c.c
+++ b/libpurple/protocols/gg/lib/protobuf-c.c
@@ -218,6 +218,8 @@ protobuf_c_buffer_simple_append (Protobu
       while (new_alloced < new_len)
         new_alloced += new_alloced;
       DO_ALLOC (new_data, &protobuf_c_default_allocator, new_alloced, return);
+      if (!new_data)
+        return;
       memcpy (new_data, simp->data, simp->len);
       if (simp->must_free_data)
         FREE (&protobuf_c_default_allocator, simp->data);
@@ -2059,6 +2061,8 @@ parse_member (ScannedMember *scanned_mem
       ufield->wire_type = scanned_member->wire_type;
       ufield->len = scanned_member->len;
       DO_UNALIGNED_ALLOC (ufield->data, allocator, scanned_member->len, return 0);
+      if (ufield->data == NULL)
+        return 0;
       memcpy (ufield->data, scanned_member->data, ufield->len);
       return 1;
     }



More information about the Commits mailing list