--- wmmultipop3.c.orig	Tue Apr 30 00:05:57 2002
+++ wmmultipop3.c	Tue Apr 30 00:04:54 2002
@@ -61,7 +61,7 @@
   char password[STR_LENGTH];
   char username[STR_LENGTH];
   char popserver[4*STR_LENGTH];
-  char mailserverid[2];
+  char mailserverid[4];
   int  port;
   int  nMsgs;
   int  nUnread;
@@ -140,7 +140,7 @@
       case 'c' :
 	if (argc > (i+1))
 	  {
-	    strcpy(config_file, argv[i+1]);
+	    strlcpy(config_file, argv[i+1], sizeof(config_file));
 	    i++;
 	  }
 	break;
@@ -180,7 +180,7 @@
   
   /* Find config-file */
   if( !strcmp( config_file, "not-defined") ) {
-    sprintf(config_file, "%s/.wmmultipop3rc", getenv("HOME")); 
+    snprintf(config_file, sizeof(config_file), "%s/.wmmultipop3rc", getenv("HOME")); 
   }
 
   /* Read config */
@@ -454,7 +454,7 @@
 
   /* If we don't have a configfile, output a new one */
   if ( (fp = fopen( filename, "r" )) == 0) {
-    sprintf(config_file, "%s/.wmmultipop3rc", getenv("HOME"));
+    snprintf(config_file, sizeof(config_file), "%s/.wmmultipop3rc", getenv("HOME"));
     printf("-Config file does not exit : %s\n",config_file);
     printf("+Trying to create new config file.\n");
     if((fp = fopen(config_file,"w")) == 0){
@@ -528,7 +528,7 @@
 	  printf("Error in mailclient string\n");
 	  return -1;
 	}
-	strcpy(conf.mailclient, ptr);
+	strlcpy(conf.mailclient, ptr, sizeof(conf.mailclient));
       }
       if ( !strcmp(ptr, "middle_click_cmd") ) {
 	ptr = strtok( 0, "\n");
@@ -536,7 +536,7 @@
 	  printf("Error in middle_click_cmd string\n");
 	  return -1;
 	}
-	strcpy(conf.middle_click_cmd, ptr);
+	strlcpy(conf.middle_click_cmd, ptr, sizeof(conf.middle_click_cmd));
       }
       if ( !strcmp(ptr, "right_click_cmd") ) {
 	ptr = strtok( 0, "\n");
@@ -544,7 +544,7 @@
 	  printf("Error in right_click_cmd string\n");
 	  return -1;
 	}
-	strcpy(conf.right_click_cmd, ptr);
+	strlcpy(conf.right_click_cmd, ptr, sizeof(conf.right_click_cmd));
       }
       if ( !strcmp(ptr, "run_command") ) {
 	ptr = strtok( 0, "\n");
@@ -552,7 +552,7 @@
 	  printf("Error in run_command string\n");
 	  return -1;
 	}
-	strcpy(conf.run_command, ptr);
+	strlcpy(conf.run_command, ptr, sizeof(conf.run_command));
       }
 
       if ( !strcmp(ptr, "popserver") ) {
@@ -565,7 +565,7 @@
 	if (popservers > 0)
 	  conf.c = (MailServerConf **)realloc(conf.c,(popservers+1)*sizeof(MailServerConf));
 	conf.c[popservers]=(MailServerConf *)malloc(sizeof(MailServerConf));
-	strcpy(conf.c[popservers]->popserver, ptr);
+	strlcpy(conf.c[popservers]->popserver, ptr, sizeof(conf.c[popservers]->popserver));
 	/*	conf.c[popservers]->nMailWaiting=0;*/
 	popservers++;
       }
@@ -584,7 +584,7 @@
 	  printf("Error in username string\n");
 	  return -1;
 	}
-	strcpy(conf.c[usernames]->username, ptr);
+	strlcpy(conf.c[usernames]->username, ptr, sizeof(conf.c[usernames]->username));
 	usernames++;
       }
       if ( !strcmp(ptr, "password") ) {
@@ -593,7 +593,7 @@
 	  printf("Error in password string\n");
 	  return -1;
 	}
-	strcpy(conf.c[passwords]->password, ptr);
+	strlcpy(conf.c[passwords]->password, ptr, sizeof(conf.c[passwords]->password));
 	passwords++;
       }
       if ( !strcmp(ptr, "mailserverid") ) {
@@ -602,7 +602,7 @@
 	  printf("Error in mail-server ID string\n");
 	  return -1;
 	}
-	strcpy(conf.c[ids]->mailserverid, ptr);
+	strlcpy(conf.c[ids]->mailserverid, ptr, sizeof(conf.c[ids]->mailserverid));
 	ids++;
       }
     }
@@ -612,10 +612,10 @@
      to mailclient (eg. left mouse click). This will preserve compability with 
      configfiles belonging to older versions of wmmultipop3 */
   if ( strlen( conf.middle_click_cmd ) < 1 ) {
-    strcpy( conf.middle_click_cmd, conf.mailclient );
+    strlcpy(conf.middle_click_cmd, conf.mailclient, sizeof(conf.middle_click_cmd));
   }
   if ( strlen( conf.right_click_cmd ) < 1 ) {
-    strcpy( conf.right_click_cmd, conf.mailclient );
+    strlcpy(conf.right_click_cmd, conf.mailclient, sizeof(conf.right_click_cmd));
   }
 
   conf.nMailBoxes = popservers;
@@ -709,7 +709,7 @@
     newx -= CHAR_WIDTH;
   } 
   
-  sprintf(buf, "%02i", num);
+  snprintf(buf, sizeof(buf), "%02i", num);
   
   BlitString(buf, newx, y);
 }
