Changeset 22 for trunk/src/samhain.c
- Timestamp:
- Feb 23, 2006, 12:03:58 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/samhain.c
r20 r22 382 382 */ 383 383 (void) sl_strlcpy (sh.host.name, _("localhost"), SH_MINIBUF); 384 sh.host.system[0] = '\0'; 384 sh.host.system[0] = '\0'; /* flawfinder: ignore *//* ff bug */ 385 385 sh.host.release[0] = '\0'; 386 386 sh.host.machine[0] = '\0'; … … 582 582 skey->mailkey_old[0] = '\0'; 583 583 skey->mailkey_new[0] = '\0'; 584 skey->crypt[0] = '\0'; 584 skey->crypt[0] = '\0'; /* flawfinder: ignore *//* ff bug */ 585 585 skey->session[0] = '\0'; 586 586 skey->vernam[0] = '\0'; … … 725 725 char exef[128]; 726 726 727 if (!pidlist) 728 return NULL; 729 727 730 for (i = 0; i < 65535; ++i) pidlist[i] = 0; 728 731 i = 0; 729 732 730 733 if (0 != stat(SH_INSTALL_PATH, &buf)) 731 return NULL; 734 { 735 free(pidlist); 736 return NULL; 737 } 732 738 733 739 ino = (long) buf.st_ino; 734 740 735 741 if (NULL == (dp = opendir("/proc"))) 736 return NULL; 742 { 743 free(pidlist); 744 return NULL; 745 } 737 746 while (NULL != (d = readdir(dp)) && i < 65535) 738 747 { … … 860 869 861 870 862 fullpath = malloc(strlen(SH_INSTALL_PATH)+1);871 fullpath = strdup (SH_INSTALL_PATH); 863 872 if (fullpath == NULL) 864 { perror(_("malloc")); exit (1); } 865 else 866 strcpy(fullpath, SH_INSTALL_PATH); /* known to fit */ 867 868 argp[0] = malloc(strlen(SH_INSTALL_PATH)+1); 873 { perror(_("strdup")); exit (1); } 874 875 argp[0] = strdup (SH_INSTALL_PATH); 869 876 if (argp[0] == NULL) 870 { perror(_("malloc")); exit (1); } 871 else 872 strcpy(argp[0], SH_INSTALL_PATH); /* known to fit */ 873 877 { perror(_("strdup")); exit (1); } 874 878 875 879 for (times = 1; times < 32; ++times) argp[times] = NULL; … … 879 883 for (times = 2; times < res; ++times) 880 884 { 881 argp[times-1] = malloc(strlen(argv[times])+1);885 argp[times-1] = strdup (argv[times]); 882 886 if (argp[times-1] == NULL) 883 { perror(_("malloc")); exit (1); } 884 else 885 strcpy(argp[times-1], argv[times]); /* known to fit */ 887 { perror(_("strdup")); exit (1); } 886 888 } 887 889 … … 903 905 _exit(4); 904 906 } 905 (void) execv(fullpath, argp); 907 (void) execv(fullpath, argp); /* flawfinder: ignore *//* wtf? */ 906 908 if (errno == EPERM) 907 909 _exit(4); … … 941 943 pidlist = procdirSamhain (); 942 944 if (pid == 0 && NULL == pidlist) /* pid file not found */ 943 return (0); 945 { 946 free(fullpath); 947 return (0); 948 } 944 949 945 950 status = 0; … … 956 961 } 957 962 } 963 free(fullpath); 958 964 if (status == 7) 959 965 return 0; … … 992 998 } 993 999 } 994 1000 free(fullpath); /* silence smatch false positive */ 995 1001 exit (1); /* no exit handler installed yet */ 996 1002 /*@notreached@*/ … … 1022 1028 /* Add a new schedule to the linked list of schedules 1023 1029 */ 1024 static sh_schedule_t * sh_set_schedule_int (c har * str,1030 static sh_schedule_t * sh_set_schedule_int (const char * str, 1025 1031 sh_schedule_t * FileSchedIn, 1026 1032 /*@out@*/ int * status) … … 1052 1058 /* Add a new schedule to the linked list FileSchedOne 1053 1059 */ 1054 int sh_set_schedule_one (c har * str)1060 int sh_set_schedule_one (const char * str) 1055 1061 { 1056 1062 int status; … … 1061 1067 /* Add a new schedule to the linked list FileSchedTwo 1062 1068 */ 1063 int sh_set_schedule_two (c har * str)1069 int sh_set_schedule_two (const char * str) 1064 1070 { 1065 1071 int status; … … 1214 1220 /* Save the timezone. 1215 1221 */ 1216 if ( (tzptr = getenv("TZ")) != NULL)1222 if (NULL != (tzptr = getenv("TZ"))) /* flawfinder: ignore */ 1217 1223 { 1218 1224 tzlen = strlen(tzptr); 1219 sh.timezone = malloc (tzlen + 1); 1220 if (sh.timezone != NULL) 1221 (void) sl_strlcpy (sh.timezone, tzptr, tzlen + 1); 1225 if (tzlen < 1024) 1226 { 1227 sh.timezone = malloc (tzlen + 1); 1228 if (sh.timezone != NULL) 1229 (void) sl_strlcpy (sh.timezone, tzptr, tzlen + 1); 1230 } 1231 else 1232 sh.timezone = NULL; 1222 1233 } 1223 1234 else
Note:
See TracChangeset
for help on using the changeset viewer.