patch-wmpop3_wmpop3_c 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. $OpenBSD: patch-wmpop3_wmpop3_c,v 1.1.1.1 2001/02/14 15:45:20 wilfried Exp $
  2. --- wmpop3/wmpop3.c.orig Fri Aug 13 17:56:19 1999
  3. +++ wmpop3/wmpop3.c Mon Feb 12 18:22:34 2001
  4. @@ -49,7 +49,7 @@ int wminet_mask_height = 64;
  5. char *ProgName;
  6. -char mailclient[32] = "pine";
  7. +char mailclient[512] = "xterm -e pine";
  8. char password[32];
  9. char username[32];
  10. char popserver[128];
  11. @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) {
  12. case 'c' :
  13. if (argc > (i+1))
  14. {
  15. - strcpy(config_file, argv[i+1]);
  16. + strlcpy(config_file, argv[i+1], sizeof(config_file));
  17. i++;
  18. }
  19. break;
  20. @@ -138,7 +138,7 @@ void wmCheckMail_routine(int argc, char
  21. Pop3 pc;
  22. if( !strcmp( config_file, "not-defined") )
  23. - sprintf(config_file, "%s/.wmpop3rc", getenv("HOME"));
  24. + snprintf(config_file, sizeof(config_file), "%s/.wmpop3rc", getenv("HOME"));
  25. if( readConfigFile(config_file) == -1){
  26. exit(0);
  27. @@ -394,7 +394,7 @@ int readConfigFile( char *filename ){
  28. FILE *fp;
  29. if( (fp = fopen( filename, "r")) == 0 ){
  30. - sprintf(config_file, "%s/.wmpop3rc", getenv("HOME"));
  31. + snprintf(config_file, sizeof(config_file), "%s/.wmpop3rc", getenv("HOME"));
  32. printf("-Config file does not exit : %s\n",config_file);
  33. printf("+Trying to create new config file.\n");
  34. if((fp = fopen(config_file,"w")) == 0){
  35. @@ -428,7 +428,7 @@ int readConfigFile( char *filename ){
  36. printf("Invalid UserName.\n");
  37. return -1;
  38. }
  39. - strcpy(username, ptr);
  40. + strlcpy(username, ptr, sizeof(username));
  41. }
  42. else if( !strcmp( ptr, "password") ){
  43. ptr = strtok( 0, " \n");
  44. @@ -436,7 +436,7 @@ int readConfigFile( char *filename ){
  45. printf("Invalid password.\n");
  46. return -1;
  47. }
  48. - strcpy(password, ptr);
  49. + strlcpy(password, ptr, sizeof(password));
  50. }
  51. else if( !strcmp( ptr, "popserver") ){
  52. ptr = strtok( 0, " \n");
  53. @@ -444,15 +444,15 @@ int readConfigFile( char *filename ){
  54. printf("Invalid popserver address.\n");
  55. return -1;
  56. }
  57. - strcpy(popserver, ptr);
  58. + strlcpy(popserver, ptr, sizeof(popserver));
  59. }
  60. else if( !strcmp( ptr, "mailclient") ){
  61. - ptr = strtok( 0, " \n");
  62. + ptr = strtok( 0, "#\n");
  63. if( ptr == 0){
  64. printf("Invalid mailclient.\n");
  65. return -1;
  66. }
  67. - strcpy(mailclient, ptr);
  68. + strlcpy(mailclient, ptr, sizeof(mailclient));
  69. }
  70. else if( !strcmp( ptr, "port") ){
  71. ptr = strtok( 0, " \n");