Skip to content

Commit d4ea104

Browse files
authored
Merge pull request #1 from sagredo-dev/compilation-warnings
Compilation warnings
2 parents ce025b8 + 00469b0 commit d4ea104

8 files changed

Lines changed: 56 additions & 67 deletions

File tree

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
27/01/2024 version 1.4.3 Roberto Puzzanghera
2+
- fixed several compilation warnings
3+
- fixed several autotools warnings
4+
15
06/12/2023 Roberto Puzzanghera
26
- added jms "debug" patch, to improve the debugging of simscan on
37
qmail-smtpd log;

aclocal.m4

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -719,35 +719,6 @@ else
719719
fi
720720
])
721721

722-
# -*- Autoconf -*-
723-
# Obsolete and "removed" macros, that must however still report explicit
724-
# error messages when used, to smooth transition.
725-
#
726-
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
727-
#
728-
# This file is free software; the Free Software Foundation
729-
# gives unlimited permission to copy and/or distribute it,
730-
# with or without modifications, as long as this notice is preserved.
731-
732-
AC_DEFUN([AM_CONFIG_HEADER],
733-
[AC_DIAGNOSE([obsolete],
734-
['$0': this macro is obsolete.
735-
You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
736-
AC_CONFIG_HEADERS($@)])
737-
738-
AC_DEFUN([AM_PROG_CC_STDC],
739-
[AC_PROG_CC
740-
am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
741-
AC_DIAGNOSE([obsolete],
742-
['$0': this macro is obsolete.
743-
You should simply use the 'AC][_PROG_CC' macro instead.
744-
Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
745-
but upon 'ac_cv_prog_cc_stdc'.])])
746-
747-
AC_DEFUN([AM_C_PROTOTYPES],
748-
[AC_FATAL([automatic de-ANSI-fication support has been removed])])
749-
AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
750-
751722
# Helper functions for option handling. -*- Autoconf -*-
752723

753724
# Copyright (C) 2001-2020 Free Software Foundation, Inc.

cdb/alloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#include <stdlib.h>
12
#include "alloc.h"
23
#include "error.h"
3-
extern char *malloc();
4+
//extern char *malloc();
45
extern void free();
56

67
#define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */

cdb/seek_cur.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <unistd.h>
12
#include <sys/types.h>
23
#include "seek.h"
34

cdb/seek_set.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <unistd.h>
12
#include <sys/types.h>
23
#include "seek.h"
34

configure

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for simscan 1.4.2.
3+
# Generated by GNU Autoconf 2.71 for simscan 1.4.3.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -607,8 +607,8 @@ MAKEFLAGS=
607607
# Identity of this package.
608608
PACKAGE_NAME='simscan'
609609
PACKAGE_TARNAME='simscan'
610-
PACKAGE_VERSION='1.4.2'
611-
PACKAGE_STRING='simscan 1.4.2'
610+
PACKAGE_VERSION='1.4.3'
611+
PACKAGE_STRING='simscan 1.4.3'
612612
PACKAGE_BUGREPORT=''
613613
PACKAGE_URL=''
614614

@@ -1340,7 +1340,7 @@ if test "$ac_init_help" = "long"; then
13401340
# Omit some internal or obsolete options to make the list less imposing.
13411341
# This message is too long to be a string in the A/UX 3.1 sh.
13421342
cat <<_ACEOF
1343-
\`configure' configures simscan 1.4.2 to adapt to many kinds of systems.
1343+
\`configure' configures simscan 1.4.3 to adapt to many kinds of systems.
13441344
13451345
Usage: $0 [OPTION]... [VAR=VALUE]...
13461346
@@ -1411,7 +1411,7 @@ fi
14111411

14121412
if test -n "$ac_init_help"; then
14131413
case $ac_init_help in
1414-
short | recursive ) echo "Configuration of simscan 1.4.2:";;
1414+
short | recursive ) echo "Configuration of simscan 1.4.3:";;
14151415
esac
14161416
cat <<\_ACEOF
14171417
@@ -1539,7 +1539,7 @@ fi
15391539
test -n "$ac_init_help" && exit $ac_status
15401540
if $ac_init_version; then
15411541
cat <<\_ACEOF
1542-
simscan configure 1.4.2
1542+
simscan configure 1.4.3
15431543
generated by GNU Autoconf 2.71
15441544
15451545
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1800,7 +1800,7 @@ cat >config.log <<_ACEOF
18001800
This file contains any messages produced by compilers while
18011801
running configure, to aid debugging if configure makes a mistake.
18021802
1803-
It was created by simscan $as_me 1.4.2, which was
1803+
It was created by simscan $as_me 1.4.3, which was
18041804
generated by GNU Autoconf 2.71. Invocation command line was
18051805
18061806
$ $0$ac_configure_args_raw
@@ -3075,7 +3075,7 @@ fi
30753075

30763076
# Define the identity of the package.
30773077
PACKAGE='simscan'
3078-
VERSION='1.4.2'
3078+
VERSION='1.4.3'
30793079

30803080

30813081
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -6632,6 +6632,7 @@ DEFS=-DHAVE_CONFIG_H
66326632
66336633
ac_libobjs=
66346634
ac_ltlibobjs=
6635+
U=
66356636
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
66366637
# 1. Remove the extension, and $U if already installed.
66376638
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
@@ -7064,7 +7065,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
70647065
# report actual input values of CONFIG_FILES etc. instead of their
70657066
# values after options handling.
70667067
ac_log="
7067-
This file was extended by simscan $as_me 1.4.2, which was
7068+
This file was extended by simscan $as_me 1.4.3, which was
70687069
generated by GNU Autoconf 2.71. Invocation command line was
70697070
70707071
CONFIG_FILES = $CONFIG_FILES
@@ -7132,7 +7133,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
71327133
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
71337134
ac_cs_config='$ac_cs_config_escaped'
71347135
ac_cs_version="\\
7135-
simscan config.status 1.4.2
7136+
simscan config.status 1.4.3
71367137
configured by $0, generated by GNU Autoconf 2.71,
71377138
with options \\"\$ac_cs_config\\"
71387139
@@ -7995,6 +7996,8 @@ fi
79957996
79967997
79977998
echo ""
7999+
echo "---------------------------------------"
8000+
echo " $PACKAGE_NAME $PACKAGE_VERSION"
79988001
echo " Current settings"
79998002
echo "---------------------------------------"
80008003
echo " user = $ENABLE_USER"

configure.ac

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
dnl Process this file with autoconf to produce a configure script.
22

3-
AC_INIT([simscan], [1.4.2])
3+
AC_PREREQ([2.71])
4+
AC_INIT([simscan],[1.4.3])
45
AC_CONFIG_SRCDIR([simscan.c])
5-
AM_INIT_AUTOMAKE
6-
AM_CONFIG_HEADER(config.h)
6+
AM_INIT_AUTOMAKE()
7+
AC_CONFIG_HEADERS([config.h])
78
AC_CANONICAL_HOST
89
AC_CHECK_FUNCS([strsep])
910

@@ -22,24 +23,21 @@ AC_ARG_ENABLE(user, [ --enable-user=<user> Change the user for simscan. Defaul
2223
[
2324
ENABLE_USER="simscan"
2425
])
25-
26+
2627
AC_MSG_CHECKING(whether the $ENABLE_USER user exists)
27-
AC_TRY_RUN( [
28+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
2829
#include <pwd.h>
2930
3031
int main() {
3132
struct passwd *pw;
32-
if (( pw=getpwnam("$ENABLE_USER")) != 0 ) return 0;
33+
if (( pw=getpwnam("$ENABLE_USER")) != 0 ) return 0;
3334
else return 1;
3435
return -1;
3536
}
36-
],
37-
AC_MSG_RESULT(yes),
38-
AC_MSG_RESULT(no)
39-
AC_MSG_ERROR(could not find the $ENABLE_USER user. Please add the $ENABLE_USER user and try again.),
40-
AC_MSG_RESULT(no)
37+
]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
38+
AC_MSG_ERROR(could not find the $ENABLE_USER user. Please add the $ENABLE_USER user and try again.)],[AC_MSG_RESULT(no)
4139
AC_MSG_ERROR(could not find the $ENABLE_USER user. Please add the $ENABLE_USER user and try again.)
42-
)
40+
])
4341

4442
AC_SUBST(ENABLE_USER)
4543

@@ -748,9 +746,12 @@ esac
748746
#----------------------------------------------------------------------
749747

750748

751-
AC_OUTPUT(Makefile)
749+
AC_CONFIG_FILES([Makefile])
750+
AC_OUTPUT
752751

753752
echo ""
753+
echo "---------------------------------------"
754+
echo " $PACKAGE_NAME $PACKAGE_VERSION"
754755
echo " Current settings"
755756
echo "---------------------------------------"
756757
echo " user = $ENABLE_USER"

simscan.c

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ char *spamc_args[MAX_SPAMC_ARGS];
9090
/* Global work buffers */
9191
#define BUFFER_SIZE 2048
9292
char buffer[BUFFER_SIZE];
93-
char message_name[BUFFER_SIZE];
93+
char message_name[BUFFER_SIZE+10];
9494
char workdir[BUFFER_SIZE];
9595
char unique_ext[BUFFER_SIZE];
9696

@@ -110,7 +110,7 @@ char *viri_args[] = { "clamdscan", "--stdout", message_name, NULL };
110110
/* To/From address processing globals */
111111
#define MAX_RCPT_TO 255
112112
#define MAX_EMAIL 500
113-
char addr_name[BUFFER_SIZE];
113+
char addr_name[BUFFER_SIZE+5];
114114
char *addr_buff;
115115
int MaxRcptTo;
116116
char MailFrom[MAX_EMAIL];
@@ -148,7 +148,7 @@ void per_domain_email_lookup (char *email);
148148

149149
/* Customer Smtp reject message globals */
150150
#ifdef ENABLE_CUSTOM_SMTP_REJECT
151-
char RejectMsg[500];
151+
char RejectMsg[BUFFER_SIZE+100];
152152
#endif
153153

154154
/* Generic virus scanner globals */
@@ -194,7 +194,7 @@ float DSpamConf=0.0;
194194
#if defined(ENABLE_DSPAM)
195195
int InHeaders;
196196
int IsSpam;
197-
char spam_message_name[BUFFER_SIZE];
197+
char spam_message_name[BUFFER_SIZE+10];
198198
int check_dspam();
199199
int is_dspam(char *spambuf);
200200
#endif
@@ -207,7 +207,7 @@ float SAReqHits;
207207
char spamuser[BUFFER_SIZE];
208208
int InHeaders;
209209
int IsSpam;
210-
char spam_message_name[BUFFER_SIZE];
210+
char spam_message_name[BUFFER_SIZE+10];
211211
int check_spam();
212212
int is_spam(char *spambuf);
213213
#endif
@@ -645,7 +645,8 @@ if (msgsize >= size_limit) {
645645
/* spamassassin processed message and no spam detected */
646646
case 0:
647647
/* open the spam file read only */
648-
strncpy(message_name,spam_message_name,BUFFER_SIZE);
648+
// strncpy(message_name,spam_message_name,BUFFER_SIZE);
649+
memcpy(message_name,spam_message_name,BUFFER_SIZE);
649650
break;
650651
/* errors , return temporary error */
651652
default:
@@ -1111,7 +1112,8 @@ int is_clam(char *clambuf)
11111112
}
11121113

11131114
if ( (tmpstr=strstr(&clambuf[j], "FOUND")) != NULL ) {
1114-
while(*tmpstr!=':' && tmpstr>clambuf) --tmpstr; ++tmpstr;
1115+
while(*tmpstr!=':' && tmpstr>clambuf) --tmpstr;
1116+
++tmpstr;
11151117
virus_name = strtok(tmpstr, " ");
11161118
memset(VirusName,0,sizeof(VirusName));
11171119
strncpy(VirusName, virus_name, sizeof(VirusName)-1);
@@ -1546,7 +1548,7 @@ void format_dir(char *workdir)
15461548
snprintf(unique_ext, sizeof(unique_ext),"%ld.%ld.%ld",
15471549
mytime.tv_sec, mytime.tv_usec, (long int)getpid());
15481550

1549-
snprintf(workdir,BUFFER_SIZE, "%s/%s", WORKDIR, unique_ext);
1551+
snprintf(workdir,BUFFER_SIZE+100, "%s/%s", WORKDIR, unique_ext);
15501552

15511553
}
15521554

@@ -1756,7 +1758,8 @@ void add_attach (char *list)
17561758
MaxAttach = 0;
17571759
if ( DebugFlag > 3 ) fprintf(stderr, "simscan:[%d]: add_attach called with %s\n", getppid(), list);
17581760
while( ( found = strsep(&list,":") ) != NULL) {
1759-
strncpy(bk_attachments[MaxAttach], found, strlen(found));
1761+
// strncpy(bk_attachments[MaxAttach], found, strlen(found));
1762+
memcpy(bk_attachments[MaxAttach], found, strlen(found));
17601763
if ( DebugFlag > 1 ) {
17611764
fprintf(stderr, "simscan:[%d]: %s is attachment number %d\n", getppid(),
17621765
bk_attachments[MaxAttach], MaxAttach);
@@ -1798,7 +1801,7 @@ int check_attach()
17981801
return(1);
17991802
}
18001803
} else {
1801-
if ( DebugFlag > 2 ) fprintf(stderr, "simscan: attachment name '%s' (%d) is shorter than '%s' (%d). IGNORED\n", mydirent->d_name, strlen( mydirent->d_name ), bk_attachments[i], strlen( bk_attachments[i] ) );
1804+
if ( DebugFlag > 2 ) fprintf(stderr, "simscan: attachment name '%s' (%lu) is shorter than '%s' (%lu). IGNORED\n", mydirent->d_name, strlen( mydirent->d_name ), bk_attachments[i], strlen( bk_attachments[i] ) );
18021805
}
18031806
}
18041807
}
@@ -1818,8 +1821,10 @@ int str_rstr(register char *h,register char *n)
18181821
register char *sh;
18191822
register char *sn;
18201823

1821-
for(sh=h;*h!=0;++h); --h;
1822-
for(sn=n;*n!=0;++n); --n;
1824+
for(sh=h;*h!=0;++h);
1825+
--h;
1826+
for(sn=n;*n!=0;++n);
1827+
--n;
18231828

18241829
for(;h>=sh && n>=sn;--h,--n) {
18251830
if ( *h!=*n ) {
@@ -1895,7 +1900,8 @@ void per_domain_lookup( char *key )
18951900

18961901
#ifdef ENABLE_SPAM
18971902
} else if ( strcasecmp(parm,"spamuser") == 0 ) {
1898-
strncpy(spamuser,val,BUFFER_SIZE);
1903+
// strncpy(spamuser,val,BUFFER_SIZE);
1904+
memcpy(spamuser,val,BUFFER_SIZE);
18991905
if ( DebugFlag > 1 ) fprintf(stderr, "simscan:[%d]: spamuser = %s\n", getppid(), spamuser);
19001906
#endif
19011907

@@ -1980,7 +1986,8 @@ void per_domain_email_lookup (char *email) {
19801986
per_domain_lookup( domain );
19811987
}
19821988

1983-
strncpy(local,email, sizeof(local));
1989+
// strncpy(local,email, sizeof(local));
1990+
memcpy(local,email, sizeof(local));
19841991
for(l_ptr=local; l_ptr!=NULL && *l_ptr!='@' && *l_ptr!='\0'; ++l_ptr );
19851992
*l_ptr='\0';
19861993
if ( DebugFlag > 1 ) fprintf(stderr, "simscan:[%d]: pelookup: local part is %s\n", getppid(), local);

0 commit comments

Comments
 (0)