openbsd-ports/net/bitlbee/patches/patch-protocols_oscar_ssi_c

51 lines
1.8 KiB
Plaintext

$OpenBSD: patch-protocols_oscar_ssi_c,v 1.3 2006/04/11 15:11:33 naddy Exp $
--- protocols/oscar/ssi.c.orig Tue Nov 1 04:10:13 2005
+++ protocols/oscar/ssi.c Tue Nov 1 21:26:48 2005
@@ -46,11 +46,7 @@ static struct aim_ssi_item *aim_ssi_item
/* Set the name */
if (name) {
- if (!(newitem->name = (char *)g_malloc((strlen(name)+1)*sizeof(char)))) {
- g_free(newitem);
- return NULL;
- }
- strcpy(newitem->name, name);
+ newitem->name = g_strdup(name);
} else
newitem->name = NULL;
@@ -413,9 +409,7 @@ int aim_ssi_cleanlist(aim_session_t *ses
if (!cur) {
for (parentgroup=sess->ssi.items; ((parentgroup) && (parentgroup->type!=AIM_SSI_TYPE_GROUP) && (parentgroup->gid==0x0000)); parentgroup=parentgroup->next);
if (!parentgroup) {
- char *newgroup;
- newgroup = (char*)g_malloc(strlen("Unknown")*sizeof(char));
- strcpy(newgroup, "Unknown");
+ char *newgroup = g_strdup("Unknown");
aim_ssi_addgroups(sess, conn, &newgroup, 1);
}
}
@@ -1375,9 +1369,10 @@ int aim_ssi_addmoddel(aim_session_t *ses
snaclen += strlen(items[i]->name);
if (subtype == AIM_CB_SSI_ADD) {
- list = g_realloc(list, listlen + strlen(items[i]->name) + 1);
- strcpy(list + listlen, items[i]->name);
- listlen += strlen(items[i]->name) + 1;
+ size_t list_newlen = listlen + strlen(items[i]->name) + 1;
+ list = g_realloc(list, list_newlen);
+ strlcat(list, items[i]->name, list_newlen);
+ listlen = list_newlen;
}
} else {
if (subtype == AIM_CB_SSI_ADD) {
@@ -1515,7 +1510,7 @@ int ssi_modfirst(aim_session_t *sess, ai
mod->toolid = 0x0110;
mod->toolversion = 0x0629;
mod->flags = 0;
- strncpy(mod->name, "ssi", sizeof(mod->name));
+ strlcpy(mod->name, "ssi", sizeof(mod->name));
mod->snachandler = snachandler;
mod->shutdown = ssi_shutdown;