File: 23-gcc8-warnings.patch

package info (click to toggle)
solid-pop3d 0.15-31
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 1,912 kB
  • sloc: ansic: 6,347; sh: 2,089; makefile: 81
file content (60 lines) | stat: -rw-r--r-- 2,194 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From: Robert Luberda <robert@debian.org>
Date: Sun, 1 Jul 2018 22:59:06 +0200
Subject: Fix gcc-8 warnings

---
 src/maildrop.c | 2 +-
 src/main.c     | 6 ++++--
 src/pop_auth.c | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/maildrop.c b/src/maildrop.c
index 9f76bfb..2e71930 100644
--- a/src/maildrop.c
+++ b/src/maildrop.c
@@ -213,7 +213,7 @@ void md_list(unsigned int nr) {
 		for (tmp = 0; tmp < msgnr; tmp++) {
 			if (messages[tmp].deleted)
 				continue;
-			snprintf(mbuf, sizeof(mbuf), "%u %u\r\n", tmp + 1, messages[tmp].crlfsize);
+			snprintf(mbuf, sizeof(mbuf), "%u %lu\r\n", tmp + 1, messages[tmp].crlfsize);
 			if (write(1, mbuf, strlen(mbuf)) != strlen(mbuf)) {
 				pop_log(pop_priority, "maildrop: can't write to socket");
 				pop_error("maildrop: write");
diff --git a/src/main.c b/src/main.c
index e7aeee0..77840fc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1251,7 +1251,8 @@ int main(int argc, char **argv)
 			mapusername[0] = 0;
 			if (domapping) {
 				if (sp_usermapprefix[0] != '\0') {
-					snprintf(usernamebuf, MAXARGLN, "%s%s", sp_usermapprefix, username);
+					strncpy(usernamebuf, sp_usermapprefix, MAXARGLN);
+					strncat(usernamebuf, username, MAXARGLN - strlen(usernamebuf));
 					strcpy(username,usernamebuf);
 				}
 /* map_finduser() doesn't overflow mapusername - sizeof(mapusername) = MAXARGLN + 1 */
@@ -1399,7 +1400,8 @@ int main(int argc, char **argv)
 			if (domapping) {
 				strcpy(origusername,username);
 				if (sp_usermapprefix[0] != '\0') {
-					snprintf(usernamebuf, MAXARGLN, "%s%s", sp_usermapprefix, username);
+					strncpy(usernamebuf, sp_usermapprefix, MAXARGLN);
+					strncat(usernamebuf, username, MAXARGLN - strlen(usernamebuf));
 					strcpy(username,usernamebuf);
 				}
 				userentry = getpwnam(mapusername);
diff --git a/src/pop_auth.c b/src/pop_auth.c
index 0751aa2..2bac94c 100644
--- a/src/pop_auth.c
+++ b/src/pop_auth.c
@@ -144,7 +144,7 @@ int main(int argc, char **argv) {
 	char username[9];
 	char *pass;
 	char passcopy[MAXARGLN + 1];
-	char txtbuff[256], buf[128];
+	char txtbuff[320], buf[128];
 	char apop_sec[128];;
 	struct rlimit corelimit = {0, 0};
 	char cfgfile[PATH_MAX];