File: validate_port_number.patch

package info (click to toggle)
tinyproxy 1.8.2-1squeeze3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,620 kB
  • ctags: 857
  • sloc: ansic: 5,641; sh: 4,067; perl: 347; makefile: 155
file content (29 lines) | stat: -rw-r--r-- 868 bytes parent folder | download
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
From: Mukund Sivaraman <muks@banu.com>
Subject: Validate port number specified in Port directive
Origin: https://banu.com/cgit/tinyproxy/commit/?h=1.8&id=95a6f8259c0e19d980f8dfe54c33c21d4ab9fe86
Forwarded: not-needed
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627503
---
diff --git a/src/conf.c b/src/conf.c
index b16b8e9..59630a2 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -779,7 +779,15 @@ static HANDLE_FUNC (handle_bindsame)
 
 static HANDLE_FUNC (handle_port)
 {
-        return set_int_arg (&conf->port, line, &match[2]);
+        set_int_arg (&conf->port, line, &match[2]);
+
+        if (conf->port > 65535) {
+                fprintf (stderr, "Bad port number (%d) supplied for Port.\n",
+                         conf->port);
+                return 1;
+        }
+
+        return 0;
 }
 
 static HANDLE_FUNC (handle_maxclients)
--
cgit