forked from yuyang-huang-90/mit-6.858-2014-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbugs.txt
71 lines (55 loc) · 1.55 KB
/
bugs.txt
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
61
62
63
64
65
66
67
68
69
70
71
#
# [file:#lines]
# desc
#
#[zookd.c:1612]
#description goes here. for example, the 'buf' variable can be
#overwritten by the 'msg' variable because ...
#
# <paste offending line(s) of code here>
#
#[http.c:1512]
#another description.
#
# <paste offending line(s) of code here>
# many more come here
### 1
[zookd.c:70]
The size of reqpath buffer should be less than 2048 bytes. Sending the request
path that is longer than 2048 bytes will cause buffer overflow.
static void process_client(int fd)
char reqpath[2048];
...
if ((errmsg = http_request_line(fd, reqpath, env, &env_len)))
### 2
[http.c:282]
The pn buffer in http_serve is only 1024 bytes. The name is the REQUEST_URI
value. If we pass the longer enough URI value, it will cause buffer overflow.
void http_serve(int fd, const char *name)
char pn[1024];
...
strcat(pn, name);
### 3
[http.c:165]
The size of envvar is 512, if the header field name size is larger than 512, it could
cause buffer overflow.
const char *http_request_headers(int fd)
...
char envvar[512];
...
sprintf(envvar, "HTTP_%s", buf);
### 4
[http.c:159]
The size of value is 512, if the header field value size is larger than 512, it could
cause buffer overflow.
const char *http_request_headers(int fd)
...
char value[512];
...
url_decode(value, sp);
### 5
[http.c:344]
The dst is the name buffer with size 1024. If the reqpath is larger
than 1024, it could cause buffer overflow.
void dir_join(char *dst, const char *dirname, const char *filename) {
strcpy(dst, dirname);