Changes in trunk/src/samhain.c [25:20]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/samhain.c
r25 r20 382 382 */ 383 383 (void) sl_strlcpy (sh.host.name, _("localhost"), SH_MINIBUF); 384 sh.host.system[0] = '\0'; /* flawfinder: ignore *//* ff bug */384 sh.host.system[0] = '\0'; 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'; /* flawfinder: ignore *//* ff bug */584 skey->crypt[0] = '\0'; 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 730 727 for (i = 0; i < 65535; ++i) pidlist[i] = 0; 731 728 i = 0; 732 729 733 730 if (0 != stat(SH_INSTALL_PATH, &buf)) 734 { 735 free(pidlist); 736 return NULL; 737 } 731 return NULL; 738 732 739 733 ino = (long) buf.st_ino; 740 734 741 735 if (NULL == (dp = opendir("/proc"))) 742 { 743 free(pidlist); 744 return NULL; 745 } 736 return NULL; 746 737 while (NULL != (d = readdir(dp)) && i < 65535) 747 738 { … … 869 860 870 861 871 fullpath = strdup (SH_INSTALL_PATH);862 fullpath = malloc(strlen(SH_INSTALL_PATH)+1); 872 863 if (fullpath == NULL) 873 { perror(_("strdup")); exit (1); } 874 875 argp[0] = strdup (SH_INSTALL_PATH); 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); 876 869 if (argp[0] == NULL) 877 { perror(_("strdup")); exit (1); } 870 { perror(_("malloc")); exit (1); } 871 else 872 strcpy(argp[0], SH_INSTALL_PATH); /* known to fit */ 873 878 874 879 875 for (times = 1; times < 32; ++times) argp[times] = NULL; … … 883 879 for (times = 2; times < res; ++times) 884 880 { 885 argp[times-1] = strdup (argv[times]);881 argp[times-1] = malloc(strlen(argv[times])+1); 886 882 if (argp[times-1] == NULL) 887 { perror(_("strdup")); exit (1); } 883 { perror(_("malloc")); exit (1); } 884 else 885 strcpy(argp[times-1], argv[times]); /* known to fit */ 888 886 } 889 887 … … 905 903 _exit(4); 906 904 } 907 (void) execv(fullpath, argp); /* flawfinder: ignore *//* wtf? */905 (void) execv(fullpath, argp); 908 906 if (errno == EPERM) 909 907 _exit(4); … … 943 941 pidlist = procdirSamhain (); 944 942 if (pid == 0 && NULL == pidlist) /* pid file not found */ 945 { 946 free(fullpath); 947 return (0); 948 } 943 return (0); 949 944 950 945 status = 0; … … 961 956 } 962 957 } 963 free(fullpath);964 958 if (status == 7) 965 959 return 0; … … 998 992 } 999 993 } 1000 free(fullpath); /* silence smatch false positive */ 994 1001 995 exit (1); /* no exit handler installed yet */ 1002 996 /*@notreached@*/ … … 1028 1022 /* Add a new schedule to the linked list of schedules 1029 1023 */ 1030 static sh_schedule_t * sh_set_schedule_int (c onst char * str,1024 static sh_schedule_t * sh_set_schedule_int (char * str, 1031 1025 sh_schedule_t * FileSchedIn, 1032 1026 /*@out@*/ int * status) … … 1058 1052 /* Add a new schedule to the linked list FileSchedOne 1059 1053 */ 1060 int sh_set_schedule_one (c onst char * str)1054 int sh_set_schedule_one (char * str) 1061 1055 { 1062 1056 int status; … … 1067 1061 /* Add a new schedule to the linked list FileSchedTwo 1068 1062 */ 1069 int sh_set_schedule_two (c onst char * str)1063 int sh_set_schedule_two (char * str) 1070 1064 { 1071 1065 int status; … … 1220 1214 /* Save the timezone. 1221 1215 */ 1222 if ( NULL != (tzptr = getenv("TZ"))) /* flawfinder: ignore */1216 if ((tzptr = getenv("TZ")) != NULL) 1223 1217 { 1224 1218 tzlen = strlen(tzptr); 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; 1219 sh.timezone = malloc (tzlen + 1); 1220 if (sh.timezone != NULL) 1221 (void) sl_strlcpy (sh.timezone, tzptr, tzlen + 1); 1233 1222 } 1234 1223 else … … 1795 1784 /* see whether its time to check files 1796 1785 */ 1797 if (sh.flag.checkSum == SH_CHECK_INIT || 1798 (sh.flag.checkSum == SH_CHECK_CHECK && 1799 (sh.flag.isdaemon == S_FALSE && sh.flag.loop == S_FALSE))) 1786 if (sh.flag.checkSum == SH_CHECK_INIT) 1800 1787 { 1801 1788 flag_check_1 = 1;
Note:
See TracChangeset
for help on using the changeset viewer.