$OpenBSD: patch-src_parse_c,v 1.5 2005/10/27 21:47:28 sturm Exp $ --- src/parse.c.orig Fri Sep 9 01:54:30 2005 +++ src/parse.c Fri Oct 21 16:35:56 2005 @@ -258,7 +258,7 @@ SetStrategies(); Debug1("\n\n==============================BEGIN NEW ACTION %s=============\n\n",ACTIONTEXT[action]); ACTION = action; -strcpy(ACTIONBUFF,ACTIONTEXT[action]); +(void)strlcpy(ACTIONBUFF,ACTIONTEXT[action],CF_BUFSIZE); switch (ACTION) { @@ -284,7 +284,7 @@ switch (ACTION) } Debug1("\nResetting CLASS to ANY\n\n"); -strcpy(CLASSBUFF,CF_ANYCLASS); /* default class */ +(void)strlcpy(CLASSBUFF,CF_ANYCLASS,CF_BUFSIZE); /* default class */ } /*******************************************************************/ @@ -300,7 +300,7 @@ Debug1("HandleLVALUE(%s) in action %s\n" if ((CONTROLVAR = ScanVariable(id)) != nonexistentvar) { - strcpy(CURRENTITEM,id); + (void)strlcpy(CURRENTITEM,id,CF_BUFSIZE); return; } else @@ -341,7 +341,7 @@ Debug1("HandleLVALUE(%s) in action %s\n" yyerror("Reserved class name (choose a different name)"); } - strcpy(GROUPBUFF,id); + (void)strlcpy(GROUPBUFF,id,CF_BUFSIZE); } break; @@ -360,14 +360,14 @@ Debug1("HandleBraceObjectID(%s) in actio switch (ACTION) { case acls: - strcpy(CURRENTOBJECT,id); + (void)strlcpy(CURRENTOBJECT,id,CF_BUFSIZE); InstallACL(id,CLASSBUFF); break; case strategies: if (strlen(STRATEGYNAME) == 0) { - strcpy(STRATEGYNAME,id); + (void)strlcpy(STRATEGYNAME,id,CF_BUFSIZE); InstallStrategy(id,CLASSBUFF); } else @@ -379,7 +379,7 @@ switch (ACTION) case editfiles: if (strlen(CURRENTOBJECT) == 0) { - strcpy(CURRENTOBJECT,id); + (void)strlcpy(CURRENTOBJECT,id,CF_BUFSIZE); EDITGROUPLEVEL = 0; FOREACHLEVEL = 0; SEARCHREPLACELEVEL = 0; @@ -393,7 +393,7 @@ switch (ACTION) case filters: if (strlen(FILTERNAME)==0) { - strcpy(FILTERNAME,id); + (void)strlcpy(FILTERNAME,id,CF_BUFSIZE); InstallFilter(id); } else @@ -419,7 +419,7 @@ switch (ACTION) case filters: case strategies: - strcpy(CURRENTITEM,id); + (void)strlcpy(CURRENTITEM,id,CF_BUFSIZE); break; case editfiles: @@ -434,7 +434,7 @@ switch (ACTION) HandleEdit(CURRENTOBJECT,id,NULL); } - strcpy(CURRENTITEM,id); + (void)strlcpy(CURRENTITEM,id,CF_BUFSIZE); break; } } @@ -470,7 +470,7 @@ else Debug1("Simple class = (%s)\n",id); } -strcpy(CLASSBUFF,id); +(void)strlcpy(CLASSBUFF,id,CF_BUFSIZE); } /*******************************************************************/ @@ -487,13 +487,13 @@ switch (ACTION) break; case filters: - strcpy(FILTERDATA,qstring); + (void)strlcpy(FILTERDATA,qstring,CF_BUFSIZE); ACTIONPENDING = true; InstallPending(ACTION); break; case strategies: - strcpy(STRATEGYDATA,qstring); + (void)strlcpy(STRATEGYDATA,qstring,CF_BUFSIZE); ACTIONPENDING = true; InstallPending(ACTION); break; @@ -507,7 +507,7 @@ switch (ACTION) { yyerror("Processes syntax error"); } - strcpy(RESTART,qstring); + (void)strlcpy(RESTART,qstring,CF_BUFSIZE); ACTIONPENDING = true; InstallPending(ACTION); @@ -531,7 +531,7 @@ switch (ACTION) yyerror("Missing process search expression"); } Debug1("Installing expression %s\n",qstring); - strcpy(EXPR,qstring); + (void)strlcpy(EXPR,qstring,CF_BUFSIZE); HAVE_RESTART = false; } else if (HAVE_RESTART) @@ -645,7 +645,7 @@ if (!IsDefinedClass(CLASSBUFF)) if (IsBuiltinFunction(fn)) { local[0] = '\0'; - strcpy(local,EvaluateFunction(fn,local)); + (void)strlcpy(local,EvaluateFunction(fn,local),sizeof(local)); switch (ACTION) { @@ -852,8 +852,8 @@ switch (ACTION) InstallPending(ACTION); InitializeAction(); Debug1("\nFound SetOptionString\n"); - strcpy(CURRENTOBJECT,"SetOptionString"); - strcpy(EXPR,"SetOptionString"); + (void)strlcpy(CURRENTOBJECT,"SetOptionString",CF_BUFSIZE); + (void)strlcpy(EXPR,"SetOptionString",CF_BUFSIZE); } else if (HAVE_RESTART) { @@ -898,7 +898,7 @@ Debug("HandleServerRule(%s=%s)\n",object if (*buffer == '/') { Debug("\n\nNew admit/deny object=%s\n",buffer); - strcpy(CURRENTAUTHPATH,object); + (void)strlcpy(CURRENTAUTHPATH,object,CF_BUFSIZE); } else { @@ -1038,7 +1038,7 @@ if ((yyin = fopen(filename,"r")) == NULL exit (1); } -strcpy(VCURRENTFILE,filename); +(void)strlcpy(VCURRENTFILE,filename,CF_BUFSIZE); Debug("\n##########################################################################\n"); Debug("# BEGIN PARSING %s\n",VCURRENTFILE); @@ -1119,7 +1119,7 @@ void RecordMacroId(char *name) { Debug("RecordMacroId(%s)\n",name); -strcpy(CURRENTITEM,name); +(void)strlcpy(CURRENTITEM,name,CF_BUFSIZE); if (strcmp(name,"this") == 0) { @@ -1149,7 +1149,7 @@ if ((sp=getenv(CF_INPUTSVAR)) != NULL) { if (!IsAbsoluteFileName(filename)) /* Don't prepend to absolute names */ { - strcpy(result,sp); + (void)strlcpy(result,sp,CF_BUFSIZE); if (! IsAbsoluteFileName(result)) { @@ -1164,13 +1164,13 @@ if ((sp=getenv(CF_INPUTSVAR)) != NULL) { if (!IsAbsoluteFileName(filename)) /* Don't prepend to absolute names */ { - strcpy(result,CFWORKDIR); + (void)strlcpy(result,CFWORKDIR,CF_BUFSIZE); AddSlash(result); - strcat(result,"inputs/"); + (void)strlcat(result,"inputs/",CF_BUFSIZE); } } -strcat(result,filename); +(void)strlcat(result,filename,CF_BUFSIZE); return result; } @@ -1201,8 +1201,8 @@ void InitializeAction() HAVE_RESTART = false; VAGE = 99999; strncpy(FINDERTYPE,"*",CF_BUFSIZE); - strcpy(VUIDNAME,"*"); - strcpy(VGIDNAME,"*"); + (void)strlcpy(VUIDNAME,"*",CF_MAXVARSIZE); + (void)strlcpy(VGIDNAME,"*",CF_MAXVARSIZE); HAVE_RESTART = 0; FILEACTION=warnall; PIFELAPSED=-1; @@ -1223,7 +1223,7 @@ void InitializeAction() PARSEMETHODRETURNCLASSES[0] = '\0'; METHODFORCE[0] = '\0'; CHROOT[0] = '\0'; - strcpy(VIFNAME,""); + (void)strlcpy(VIFNAME,"",sizeof(VIFNAME)); PTRAVLINKS = (short) '?'; IMAGEBACKUP = 'y'; ENCRYPT = 'n'; @@ -1266,7 +1266,7 @@ void InitializeAction() memset(ALLCLASSBUFFER,0,CF_BUFSIZE); memset(ELSECLASSBUFFER,0,CF_BUFSIZE); - strcpy(CFSERVER,"localhost"); + (void)strlcpy(CFSERVER,"localhost",CF_MAXVARSIZE); IMGCOMP = DISCOMP='>'; IMGSIZE = DISABLESIZE=CF_NOSIZE;