38 lines
917 B
Plaintext
38 lines
917 B
Plaintext
$OpenBSD: patch-src_macro_c,v 1.3 2004/10/01 21:22:15 sturm Exp $
|
|
--- src/macro.c.orig Mon Aug 2 20:52:24 2004
|
|
+++ src/macro.c Fri Oct 1 23:14:48 2004
|
|
@@ -175,6 +175,7 @@ void AddMacroValue(char *scope,char *nam
|
|
{ char *sp, buffer[CF_BUFSIZE],exp[CF_EXPANDSIZE];
|
|
struct cfObject *ptr;
|
|
int slot;
|
|
+ size_t buflen;
|
|
|
|
Debug("AddMacroValue(%s.%s=%s)\n",scope,name,value);
|
|
|
|
@@ -196,13 +197,14 @@ ptr = ObjectContext(scope);
|
|
|
|
snprintf(buffer,CF_BUFSIZE,"%s=%s",name,exp);
|
|
|
|
-if ((sp = malloc(strlen(buffer)+1)) == NULL)
|
|
+buflen = strlen(buffer) + 1;
|
|
+if ((sp = malloc(buflen)) == NULL)
|
|
{
|
|
perror("malloc");
|
|
FatalError("aborting");
|
|
}
|
|
|
|
-strcpy(sp,buffer);
|
|
+(void)strlcpy(sp,buffer,buflen);
|
|
|
|
slot = Hash(name);
|
|
|
|
@@ -319,7 +321,7 @@ if (strstr(name,"."))
|
|
|
|
if (ptr == NULL)
|
|
{
|
|
- strcpy(vname,name);
|
|
+ (void)strlcpy(vname,name,sizeof(vname));
|
|
ptr = ObjectContext(scope);
|
|
}
|
|
|