Skip to content

Commit 8d711b5

Browse files
committed
fixed several compilation warnings
1 parent ce025b8 commit 8d711b5

4 files changed

Lines changed: 25 additions & 15 deletions

File tree

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

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)