openbsd-ports/net/bitlbee/patches/patch-protocols_jabber_pool_c
naddy a2c69a5b0d Update to 0.90.
Partial audit for string handling.

From: Andrew Dalgleish <openbsd@ajd.net.au>
2004-06-20 16:27:49 +00:00

32 lines
856 B
Plaintext

$OpenBSD: patch-protocols_jabber_pool_c,v 1.1 2004/06/20 16:27:49 naddy Exp $
--- protocols/jabber/pool.c.orig 2004-04-15 00:55:58.000000000 +1000
+++ protocols/jabber/pool.c 2004-06-08 22:21:12.000000000 +1000
@@ -76,8 +76,8 @@ pool _pool_new(char *zone)
#ifdef POOL_DEBUG
p->lsize = -1;
p->zone[0] = '\0';
- strcat(p->zone,zone);
- sprintf(p->name,"%X",p);
+ strlcat(p->zone,zone, sizeof(p->zone));
+ snprintf(p->name, sizeof(p->name),"%X",p);
if(pool__disturbed == NULL)
{
@@ -213,12 +213,14 @@ void *pmalloco(pool p, int size)
char *pstrdup(pool p, const char *src)
{
char *ret;
+ size_t len;
if(src == NULL)
return NULL;
- ret = pmalloc(p,strlen(src) + 1);
- strcpy(ret,src);
+ len = strlen(src) + 1;
+ ret = pmalloc(p, len);
+ strlcpy(ret,src, len);
return ret;
}