summaryrefslogtreecommitdiff
path: root/chat/centericq/patches/patch-af
diff options
context:
space:
mode:
Diffstat (limited to 'chat/centericq/patches/patch-af')
-rw-r--r--chat/centericq/patches/patch-af80
1 files changed, 80 insertions, 0 deletions
diff --git a/chat/centericq/patches/patch-af b/chat/centericq/patches/patch-af
new file mode 100644
index 00000000000..4ffe4344711
--- /dev/null
+++ b/chat/centericq/patches/patch-af
@@ -0,0 +1,80 @@
+$NetBSD: patch-af,v 1.1 2005/09/19 19:42:11 adrianp Exp $
+
+--- libgadu-0.1/common.c.orig 2004-07-31 11:47:20.000000000 +0100
++++ libgadu-0.1/common.c
+@@ -284,6 +284,8 @@ char *gg_read_line(int sock, char *buf,
+ {
+ int ret;
+
++ if (!buf || length < 0)
++ return NULL;
+ for (; length > 1; buf++, length--) {
+ do {
+ if ((ret = read(sock, buf, 1)) == -1 && errno != EINTR) {
+@@ -340,7 +342,7 @@ char *gg_urlencode(const char *str)
+ {
+ char *q, *buf, hex[] = "0123456789abcdef";
+ const char *p;
+- int size = 0;
++ unsigned int size = 0;
+
+ if (!str && !(str = strdup("")))
+ return NULL;
+@@ -392,18 +394,18 @@ int gg_http_hash(const char *format, ...
+ va_start(ap, format);
+
+ for (j = 0; j < strlen(format); j++) {
+- unsigned char *arg, buf[16];
++ char *arg, buf[16];
+
+ if (format[j] == 'u') {
+ snprintf(buf, sizeof(buf), "%d", va_arg(ap, uin_t));
+ arg = buf;
+ } else {
+- if (!(arg = va_arg(ap, unsigned char*)))
++ if (!(arg = va_arg(ap, char*)))
+ arg = "";
+ }
+
+ i = 0;
+- while ((c = (int) arg[i++]) != 0) {
++ while ((c = (unsigned char) arg[i++]) != 0) {
+ a = (c ^ b) + (c << 8);
+ b = (a >> 24) | (a << 8);
+ }
+@@ -532,7 +534,7 @@ static char gg_base64_charset[] =
+ char *gg_base64_encode(const char *buf)
+ {
+ char *out, *res;
+- int i = 0, j = 0, k = 0, len = strlen(buf);
++ unsigned int i = 0, j = 0, k = 0, len = strlen(buf);
+
+ res = out = malloc((len / 3 + 1) * 4 + 2);
+
+@@ -590,7 +592,7 @@ char *gg_base64_decode(const char *buf)
+ {
+ char *res, *save, *foo, val;
+ const char *end;
+- int index = 0;
++ unsigned int index = 0;
+
+ if (!buf)
+ return NULL;
+@@ -684,7 +686,7 @@ static int gg_crc32_initialized = 0;
+ static void gg_crc32_make_table()
+ {
+ uint32_t h = 0;
+- int i, j;
++ unsigned int i, j;
+
+ memset(gg_crc32_table, 0, sizeof(gg_crc32_table));
+
+@@ -713,6 +715,8 @@ uint32_t gg_crc32(uint32_t crc, const un
+ {
+ if (!gg_crc32_initialized)
+ gg_crc32_make_table();
++ if (!buf || len < 0)
++ return crc;
+
+ crc ^= 0xffffffffL;
+