changed a couple of places to use strlcpy()
[rsync/rsync.git] / loadparm.c
index d22bef8..7fff24f 100644 (file)
@@ -52,7 +52,7 @@
 #define strequal(a,b) (strcasecmp(a,b)==0)
 #define BOOLSTR(b) ((b) ? "Yes" : "No")
 typedef char pstring[1024];
-#define pstrcpy(a,b) strcpy(a,b)
+#define pstrcpy(a,b) strlcpy(a,b,sizeof(pstring)-1)
 
 /* the following are used by loadparm for option lists */
 typedef enum
@@ -221,13 +221,12 @@ initialise a service to the defaults
 ***************************************************************************/
 static void init_service(service *pservice)
 {
-  bzero((char *)pservice,sizeof(service));
-  copy_service(pservice,&sDefault);
+       bzero((char *)pservice,sizeof(service));
+       copy_service(pservice,&sDefault);
 }
 
 static void string_set(char **s, char *v)
 {
-       if (*s) free(*s);
        if (!v) {
                *s = NULL;
                return;