Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/samhain.c

    r25 r20  
    382382   */
    383383  (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';
    385385  sh.host.release[0]    = '\0';
    386386  sh.host.machine[0]    = '\0';
     
    582582  skey->mailkey_old[0]  = '\0';
    583583  skey->mailkey_new[0]  = '\0';
    584   skey->crypt[0]        = '\0'; /* flawfinder: ignore *//* ff bug */
     584  skey->crypt[0]        = '\0';
    585585  skey->session[0]      = '\0';
    586586  skey->vernam[0]       = '\0';
     
    725725  char         exef[128];
    726726
    727   if (!pidlist)
    728     return NULL;
    729 
    730727  for (i = 0; i < 65535; ++i) pidlist[i] = 0;
    731728  i = 0;
    732729
    733730  if (0 != stat(SH_INSTALL_PATH, &buf))
    734     {
    735       free(pidlist);
    736       return NULL;
    737     }
     731    return NULL;
    738732
    739733  ino = (long) buf.st_ino;
    740734   
    741735  if (NULL == (dp = opendir("/proc")))
    742     {
    743       free(pidlist);
    744       return NULL;
    745     }
     736    return NULL;
    746737  while (NULL != (d = readdir(dp)) && i < 65535)
    747738    {
     
    869860
    870861
    871   fullpath = strdup (SH_INSTALL_PATH);
     862  fullpath = malloc(strlen(SH_INSTALL_PATH)+1);
    872863  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);
    876869  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
    878874
    879875  for (times = 1; times < 32; ++times)  argp[times] = NULL;
     
    883879  for (times = 2; times < res; ++times) 
    884880    {
    885       argp[times-1] = strdup (argv[times]);
     881      argp[times-1] = malloc(strlen(argv[times])+1);
    886882      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  */
    888886    }
    889887
     
    905903            _exit(4);
    906904          }
    907         (void) execv(fullpath, argp); /* flawfinder: ignore *//* wtf? */
     905        (void) execv(fullpath, argp);
    908906        if (errno == EPERM)
    909907          _exit(4);
     
    943941      pidlist = procdirSamhain ();
    944942      if (pid == 0 && NULL == pidlist) /* pid file not found */
    945         {
    946           free(fullpath);
    947           return (0);
    948         }
     943        return (0);
    949944         
    950945      status = 0;
     
    961956            }
    962957        }
    963       free(fullpath);
    964958      if (status == 7)
    965959        return 0;
     
    998992        }
    999993    }
    1000   free(fullpath); /* silence smatch false positive */
     994
    1001995  exit (1); /* no exit handler installed yet */
    1002996  /*@notreached@*/
     
    10281022/* Add a new schedule to the linked list of schedules
    10291023 */
    1030 static sh_schedule_t * sh_set_schedule_int (const char * str,
     1024static sh_schedule_t * sh_set_schedule_int (char * str,
    10311025                                            sh_schedule_t * FileSchedIn,
    10321026                                            /*@out@*/ int * status)
     
    10581052/* Add a new schedule to the linked list FileSchedOne
    10591053 */
    1060 int sh_set_schedule_one (const char * str)
     1054int sh_set_schedule_one (char * str)
    10611055{
    10621056  int status;
     
    10671061/* Add a new schedule to the linked list FileSchedTwo
    10681062 */
    1069 int sh_set_schedule_two (const char * str)
     1063int sh_set_schedule_two (char * str)
    10701064{
    10711065  int status;
     
    12201214  /* Save the timezone.
    12211215   */
    1222   if (NULL != (tzptr = getenv("TZ"))) /* flawfinder: ignore */
     1216  if ((tzptr = getenv("TZ")) != NULL)
    12231217    {
    12241218      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);
    12331222    }
    12341223  else
     
    17951784      /* see whether its time to check files
    17961785       */
    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)
    18001787        {
    18011788          flag_check_1 = 1;
Note: See TracChangeset for help on using the changeset viewer.