openbsd-ports/net/bitlbee/patches/patch-protocols_jabber_jabber_c
simon 53e6084bfe update to version 1.0.3
from Martynas Venckus <martynas at altroot dot org>
2007-01-14 21:53:01 +00:00

56 lines
2.1 KiB
Plaintext

$OpenBSD: patch-protocols_jabber_jabber_c,v 1.4 2007/01/14 21:53:01 simon Exp $
--- protocols/jabber/jabber.c.orig Sat Jun 24 17:00:44 2006
+++ protocols/jabber/jabber.c Fri Dec 15 21:20:07 2006
@@ -285,7 +285,7 @@ static char *gjab_getsid(gjconn gjc)
static char *gjab_getid(gjconn gjc)
{
- g_snprintf(gjc->idbuf, 8, "%d", gjc->id++);
+ g_snprintf(gjc->idbuf, sizeof(gjc->idbuf), "%d", gjc->id++);
return &gjc->idbuf[0];
}
@@ -381,10 +381,11 @@ static void gjab_auth(gjconn gjc)
xmlnode_insert_cdata(z, gjc->user->resource, -1);
if (gjc->sid) {
+ size_t hash_len = strlen(gjc->sid) + strlen(gjc->pass) + 1;
z = xmlnode_insert_tag(y, "digest");
- hash = pmalloc(x->p, strlen(gjc->sid) + strlen(gjc->pass) + 1);
- strcpy(hash, gjc->sid);
- strcat(hash, gjc->pass);
+ hash = pmalloc(x->p, hash_len);
+ strlcpy(hash, gjc->sid, hash_len);
+ strlcat(hash, gjc->pass, hash_len);
hash = shahash(hash);
xmlnode_insert_cdata(z, hash, 40);
} else {
@@ -1214,8 +1215,7 @@ static void jabber_handlebuddy(gjconn gj
serv_got_update(GJ_GC(gjc), buddyname, 1, 0, signon, idle, uc, 0);
}
} else if(name != NULL && strcmp(b->show, name)) {
- strncpy(b->show, name, BUDDY_ALIAS_MAXLEN);
- b->show[BUDDY_ALIAS_MAXLEN - 1] = '\0'; /* cheap safety feature */
+ strlcpy(b->show, name, BUDDY_ALIAS_MAXLEN);
serv_buddy_rename(GJ_GC(gjc), buddyname, b->show);
}
}
@@ -1355,7 +1355,7 @@ static void jabber_handlelast(gjconn gjc
xmlnode_put_attrib(x, "to", from);
xmlnode_put_attrib(x, "id", id);
querytag = xmlnode_get_tag(x, "query");
- g_snprintf(idle_time, sizeof idle_time, "%ld", jd->idle ? time(NULL) - jd->idle : 0);
+ g_snprintf(idle_time, sizeof idle_time, "%ld", jd->idle ? time(NULL) - jd->idle : 0L);
xmlnode_put_attrib(querytag, "seconds", idle_time);
gjab_send(gjc, x);
@@ -2134,7 +2134,7 @@ static xmlnode insert_tag_to_parent_tag(
/*
* Descend?
*/
- char *grand_parent = strcpy(g_malloc(strlen(parent_tag) + 1), parent_tag);
+ char *grand_parent = g_strdup(parent_tag);
char *parent;
if((parent = strrchr(grand_parent, '/')) != NULL) {