56 lines
2.1 KiB
Plaintext
56 lines
2.1 KiB
Plaintext
$OpenBSD: patch-protocols_jabber_jabber_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
|
|
--- protocols/jabber/jabber.c.orig Wed Sep 8 06:54:23 2004
|
|
+++ protocols/jabber/jabber.c Fri Oct 15 14:33:18 2004
|
|
@@ -287,7 +287,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];
|
|
}
|
|
|
|
@@ -383,10 +383,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 {
|
|
@@ -1241,8 +1242,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);
|
|
}
|
|
}
|
|
@@ -1389,7 +1389,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);
|
|
@@ -2170,7 +2170,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) {
|