openbsd-ports/sysutils/cfengine/patches/patch-src_comparray_c
sturm aec4c941c3 revive cfengine port
this is version 2.1.6, from and maintained by
William Yodlowsky <bsd at openbsd.rutgers.edu>
2004-06-17 11:21:42 +00:00

29 lines
777 B
Plaintext

$OpenBSD: patch-src_comparray_c,v 1.1 2004/06/17 11:21:43 sturm Exp $
--- src/comparray.c.orig 2004-06-10 10:50:03.000000000 -0400
+++ src/comparray.c 2004-06-10 11:30:47.000000000 -0400
@@ -39,6 +39,7 @@ int FixCompressedArrayValue(int i,char *
{ struct CompressedArray *ap;
char *sp;
+ size_t buflen;
for (ap = *start; ap != NULL; ap = ap->next)
{
@@ -57,13 +58,14 @@ if ((ap = (struct CompressedArray *)mall
FatalError("");
}
-if ((sp = malloc(strlen(value)+2)) == NULL)
+buflen = strlen(value) + 2;
+if ((sp = malloc(buflen)) == NULL)
{
CfLog(cferror,"Can't allocate memory in SetCompressedArray()","malloc");
FatalError("");
}
-strcpy(sp,value);
+(void)strlcpy(sp,value,buflen);
ap->key = i;
ap->value = sp;
ap->next = *start;