Changeset 590


Ignore:
Timestamp:
Oct 27, 2025, 6:57:03 PM (6 hours ago)
Author:
katerina
Message:

Fix for ticket #478 (cppcheck warnings).

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r588 r590  
    44dnl AU_ALIAS([_AC_INIT_help], [SH_INIT_HELP])
    55
    6 AC_INIT([samhain],[4.5.2])
     6AC_INIT([samhain],[4.5.3])
    77AC_CONFIG_SRCDIR(src/samhain.c)
    88
  • trunk/docs/Changelog

    r588 r590  
    77        * move logfile monitor module from PCRE to PCRE2 (PCRE is end of life and no
    88        longer actively maintained)
     9        * fix obsolete gpg option --secret-keyring used in samhainadmin script
     10        * fix some more warnings, mostly false positives from cppcheck
    911
    10124.5.2 (02-01-2025):
  • trunk/src/rijndael-api-fst.c

    r481 r590  
    103103
    104104                /* memcpy(key->keyMaterial, keyMaterial, keyLen/8); */
     105                /* cppcheck-suppress uninitvar */
    105106                memcpy(key->keyMaterial, temp, keyLen/8);
    106107        }
  • trunk/src/sh_files.c

    r579 r590  
    338338    here = (dirstack_t *) inptr;
    339339
     340  /* cppcheck-suppress uninitStructMember */
    340341  if (here->name != NULL)
    341342    SH_FREE(here->name);
     
    892893static int sh_files_parse_mask (unsigned long * mask, const char * str)
    893894{
    894   int l, i = 0, act = 0, k = 0;
     895  int l = 0, i = 0, act = 0, k = 0;
    895896  char  myword[64];
    896897 
     
    13961397    here = (sh_globstack_t *) inptr;
    13971398
     1399  /* cppcheck-suppress uninitStructMember */
    13981400  if (here->name != NULL)
    13991401    SH_FREE(here->name);
  • trunk/src/sh_hash.c

    r583 r590  
    12871287#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
    12881288  p.attributes  = (UINT32) buf->attributes;
     1289#else
     1290  p.attributes  = (UINT32) 0;
    12891291#endif
    12901292  p.linkmode    = (UINT32) buf->linkmode;
  • trunk/src/sh_log_parse_pacct.c

    r588 r590  
    252252     
    253253#if defined(ac_flagx)
     254      /* cppcheck-suppress syntaxError */
    254255      expand_flags(rec.ac_flagx, fl);
    255256#else
  • trunk/src/sh_portcheck.c

    r560 r590  
    957957  int                retval;
    958958  char             * p = NULL;
    959   char               buf[8];
     959  char               buf[8] = { 0 };
    960960#ifndef TEST_ONLY
    961961  char               errmsg[256];
  • trunk/src/sh_registry.c

    r541 r590  
    905905                               qError,
    906906                               MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
     907                               /* cppcheck-suppress uninitvar */
    907908                               (LPTSTR) &lpMsgBuf,
    908909                               0, NULL );
     
    10071008
    10081009  /* Returns 0 if !subkey */
    1009   /* cppcheck-suppress uninitvar */
     1010  /* cppcheck-suppress legacyUninitvar */
    10101011  return CheckThisSubkey (topKey, subkey, path, isSingle, 0);
    10111012}
  • trunk/src/sh_suidchk.c

    r583 r590  
    10191019  SL_ENTER(_("sh_suidchk_check_internal"));
    10201020
     1021  if (iname == NULL)
     1022    {
     1023      TPT((0, FIL__, __LINE__ , _("msg=<directory name is NULL>\n")));
     1024      SL_RETURN( (-1), _("sh_suidchk_check_internal"));
     1025    }
     1026
     1027  if (sig_urgent > 0) {
     1028    SL_RETURN( (0), _("sh_suidchk_check_internal"));
     1029  }
     1030
    10211031  /* Take the address to keep gcc from putting it into a register.
    10221032   * Avoids the 'clobbered by longjmp' warning.
     
    10241034  sh_dummy_idirlist = (void*) &dirlist;
    10251035  sh_dummy_itmp     = (void*) &tmp;
    1026 
    1027   if (iname == NULL)
    1028     {
    1029       TPT((0, FIL__, __LINE__ , _("msg=<directory name is NULL>\n")));
    1030       SL_RETURN( (-1), _("sh_suidchk_check_internal"));
    1031     }
    1032 
    1033   if (sig_urgent > 0) {
    1034     SL_RETURN( (0), _("sh_suidchk_check_internal"));
    1035   }
    10361036
    10371037  thisDir = opendir (iname);
     
    10471047      SH_MUTEX_UNLOCK(mutex_thread_nolog);
    10481048      SH_FREE(tmp);
     1049      sh_dummy_idirlist = NULL;
     1050      sh_dummy_itmp     = NULL;
    10491051      SL_RETURN( (-1), _("sh_suidchk_check_internal"));
    10501052    }
     
    14121414  kill_sh_dirlist (dirlist_orig);
    14131415
     1416  sh_dummy_idirlist = NULL;
     1417  sh_dummy_itmp     = NULL;
     1418
    14141419  SL_RETURN( (0), _("sh_suidchk_check_internal"));
    14151420}
     
    21932198   Return "unknown" if its filesystem type is unknown.  */
    21942199
    2195 static char *
    2196 filesystem_type (char * path, char * relpath, struct stat * statp)
     2200static char * filesystem_type (char * path, char * relpath, struct stat * statp)
    21972201{
    21982202  static char *current_fstype = NULL;
     
    22182222void * sh_dummy_2229_type;
    22192223
    2220 static char *
    2221 filesystem_type_uncached (path, relpath, statp)
    2222      char *path;
    2223      char *relpath;
    2224      struct stat *statp;
     2224static char * filesystem_type_uncached (char * path, char * relpath, struct stat * statp)
    22252225{
    22262226  char * type = NULL;
     
    22342234  struct mntent *mnt;
    22352235
     2236  if (path == NULL || relpath == NULL)
     2237    return NULL;
     2238
    22362239  /* Take the address to keep gcc from putting it into a register.
    22372240   * Avoids the 'clobbered by longjmp' warning.
    22382241   */
    22392242  sh_dummy_2229_type = (void *) &type;
    2240 
    2241   if (path == NULL || relpath == NULL)
    2242     return NULL;
    22432243
    22442244  mfp = setmntent (table, "r");
     
    22502250                       _("filesystem_type_uncached") );
    22512251      SH_MUTEX_UNLOCK(mutex_thread_nolog);
     2252      sh_dummy_2229_type = NULL;
    22522253      return NULL;
    22532254    }
     
    23782379                           _("filesystem_type_uncached") );
    23792380          SH_MUTEX_UNLOCK(mutex_thread_nolog);
     2381          sh_dummy_2229_type = NULL;
    23802382          return NULL;
    23812383        }
     
    24062408                           _("filesystem_type_uncached") );
    24072409          SH_MUTEX_UNLOCK(mutex_thread_nolog);
     2410          sh_dummy_2229_type = NULL;
    24082411          return NULL;
    24092412        }
     
    24532456                           _("filesystem_type_uncached") );
    24542457          SH_MUTEX_UNLOCK(mutex_thread_nolog);
     2458          sh_dummy_2229_type = NULL;
    24552459          return NULL;
    24562460        }
     
    24922496  fstype_known = (int)(type != NULL);
    24932497
     2498  sh_dummy_2229_type = NULL;
    24942499  return sh_util_strdup (type ? type : "unknown");
    24952500}
     
    25002505   part of CP. */
    25012506
    2502 static int
    2503 xatoi (cp)
    2504      const char *cp;
     2507static int xatoi (const char * cp)
    25052508{
    25062509  int val;
  • trunk/src/sh_unix.c

    r583 r590  
    1717/*  along with this program; if not, write to the Free Software            */
    1818/*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.              */
     19
     20/* cppcheck-suppress-file unknownMacro */
    1921
    2022#include "config_xor.h"
     
    24122414  char          AsciiTime[81];                       /* local time   */
    24132415  time_t        time_now;
    2414   struct tm   * time_ptr;
     2416  struct tm   * time_ptr = NULL;
    24152417#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_LOCALTIME_R)
    24162418  struct tm     time_tm;
     
    25462548#endif
    25472549    }
     2550
    25482551  if (time_ptr != NULL)
    25492552    {
  • trunk/src/sh_utils.c

    r583 r590  
    769769  char        K[KEY_BLOCK];
    770770  char        outer[KEY_BLOCK];
    771   char      * inner;
     771  char      * inner = NULL;
    772772  UINT32    * h1;
    773773  UINT32    * h2;
  • trunk/src/sh_xfer_server.c

    r583 r590  
    484484    here = (client_t *) inptr;
    485485
     486  /* cppcheck-suppress uninitStructMember */
    486487  if (here->hostname != NULL)
    487488    SH_FREE(here->hostname);
     
    506507    here = (alias_t *) inptr;
    507508
     509  /* cppcheck-suppress uninitStructMember */
    508510  if (here->alias != NULL)
    509511    SH_FREE(here->alias);
  • trunk/test/testrun_1f.sh

    r550 r590  
    6363prep_sign_file ()
    6464{
    65     scripts/samhainadmin.pl -s ./test/gnupg/ -m R $1 >/dev/null
    66     scripts/samhainadmin.pl -s ./test/gnupg/ -k 8A0B337A -m E $1 >/dev/null
     65    scripts/samhainadmin.pl -m R $1 >/dev/null
     66    scripts/samhainadmin.pl -k 8A0B337A -m E $1 >/dev/null
    6767}
    6868
  • trunk/test/testrun_2g.sh

    r577 r590  
    336336        UUID=$(uuidgen)
    337337        if [ x"$1" != "xnosig" ]; then
    338             scripts/samhainadmin.pl -s ./test/gnupg/ -k 8A0B337A -m E ./file.delta >/dev/null
     338            scripts/samhainadmin.pl -k 8A0B337A -m E ./file.delta >/dev/null
    339339        fi
    340340        if [ x"$1" == "xnodelta" ]; then
     
    612612testrun2g_signrc ()
    613613{
    614     scripts/samhainadmin.pl -s ./test/gnupg/ -m R $1 >/dev/null
    615     scripts/samhainadmin.pl -s ./test/gnupg/ -k 8A0B337A -m E $1 >/dev/null
     614    scripts/samhainadmin.pl -m R $1 >/dev/null
     615    scripts/samhainadmin.pl -k 8A0B337A -m E $1 >/dev/null
    616616}
    617617
    618618testrun2g_signdb ()
    619619{
    620     scripts/samhainadmin.pl -s ./test/gnupg/ -k 8A0B337A -m E ./.samhain_file >/dev/null
     620    scripts/samhainadmin.pl -k 8A0B337A -m E ./.samhain_file >/dev/null
    621621}
    622622
Note: See TracChangeset for help on using the changeset viewer.