about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2006-11-15 01:22:36 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2006-11-15 01:22:36 -0500
commit6c9c916af1599d2daefcfc43854b456157030a2a (patch)
treec7b1a320dec75a241334900631c3c861969a4b9f /src
parent9bdb7e3f3d8fb762919e6d55aaea5e7263dd970d (diff)
downloadlynx-snapshots-6c9c916af1599d2daefcfc43854b456157030a2a.tar.gz
snapshot of project "lynx", label v2-8-7dev_4
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c8
-rw-r--r--src/LYUtils.c35
2 files changed, 21 insertions, 22 deletions
diff --git a/src/GridText.c b/src/GridText.c
index c1b93045..c99011f5 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -11422,11 +11422,17 @@ int HText_SubmitForm(FormInfo * submit_item, DocInfo *doc, char *link_name,
 		    StrAllocCopy(escaped1, my_data[anchor_count].name);
 		} else if (Boundary) {
 		    const char *t = guess_content_type(val_used);
+		    char *copied_fname = NULL;
 
 		    StrAllocCopy(escaped1, "Content-Disposition: form-data");
 		    HTSprintf(&escaped1, "; name=\"%s\"",
 			      my_data[anchor_count].name);
-		    HTSprintf(&escaped1, "; filename=\"%s\"", val_used);
+
+		    StrAllocCopy(copied_fname, val_used);
+		    HTMake822Word(&copied_fname, FALSE);
+		    HTSprintf(&escaped1, "; filename=\"%s\"", copied_fname);
+		    FREE(copied_fname);
+
 		    /* Should we take into account the encoding? */
 		    HTSprintf(&escaped1, "\r\nContent-Type: %s", t);
 		    if (my_data[anchor_count].quote == QUOTE_BASE64)
diff --git a/src/LYUtils.c b/src/LYUtils.c
index c4b3a9f1..07802c20 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -37,11 +37,17 @@ int kbhit(void);		/* FIXME: use conio.h */
 #endif
 
 #ifdef _WINDOWS			/* 1998/04/30 (Thu) 19:04:25 */
-#define GETPID()	(getpid() & 0xffff)
+#define GETPID()	(unsigned) (getpid() & 0xffff)
 #else
-#define GETPID()	getpid()
+#define GETPID()	(unsigned) getpid()
 #endif /* _WINDOWS */
 
+#ifdef FNAMES_8_3
+#define PID_FMT "%04x"
+#else
+#define PID_FMT "%u"
+#endif
+
 #ifdef DJGPP_KEYHANDLER
 #include <bios.h>
 #endif /* DJGPP_KEYHANDLER */
@@ -3065,19 +3071,11 @@ void change_sug_filename(char *fname)
      * Rename any temporary files.
      */
     cp2 = wwwName(lynx_temp_space);
-#ifdef FNAMES_8_3
     if (LYIsHtmlSep(*cp2)) {
-	HTSprintf0(&temp, "file://localhost%s%04x", cp2, GETPID());
+	HTSprintf0(&temp, "file://localhost%s" PID_FMT, cp2, GETPID());
     } else {
-	HTSprintf0(&temp, "file://localhost/%s%04x", cp2, GETPID());
+	HTSprintf0(&temp, "file://localhost/%s" PID_FMT, cp2, GETPID());
     }
-#else
-    if (LYIsHtmlSep(*cp2)) {
-	HTSprintf0(&temp, "file://localhost%s%d", cp2, (int) getpid());
-    } else {
-	HTSprintf0(&temp, "file://localhost/%s%d", cp2, (int) getpid());
-    }
-#endif
     if (!strncmp(fname, temp, strlen(temp))) {
 	cp = strrchr(fname, '.');
 	if (strlen(cp) > (strlen(temp) - 4))
@@ -3403,11 +3401,7 @@ static int fmt_tempname(char *result,
      * the suffix may contain more than a ".htm", e.g., "-txt.gz", so we trim
      * off from the filename portion to make room.
      */
-#ifdef _WINDOWS
-    sprintf(leaf, "%04x%04x", counter, (unsigned) GETPID());
-#else
-    sprintf(leaf, "%u%u", counter, (unsigned) getpid());
-#endif
+    sprintf(leaf, PID_FMT PID_FMT, counter, GETPID());
     if (strlen(leaf) > 8)
 	leaf[8] = 0;
     if (strlen(suffix) > 4 || *suffix != '.') {
@@ -3420,7 +3414,7 @@ static int fmt_tempname(char *result,
     }
     strcat(leaf, suffix);
 #else
-    sprintf(leaf, "L%u-%uTMP%s", (unsigned) getpid(), counter, suffix);
+    sprintf(leaf, "L" PID_FMT "-%uTMP%s", GETPID(), counter, suffix);
 #endif
     /*
      * Someone could have configured the temporary pathname to be too long.
@@ -5370,8 +5364,7 @@ char *LYTildeExpand(char **pathname,
 {
     char *temp = FindLeadingTilde(*pathname, embedded);
 
-    if (temp != NULL
-	&& LYIsTilde(temp[0])) {
+    if (LYIsTilde(temp[0])) {
 
 	CTRACE((tfp, "LYTildeExpand %s\n", *pathname));
 	if (LYIsPathSep(temp[1])
@@ -6750,7 +6743,7 @@ BOOLEAN LYValidateFilename(char *result,
 	return TRUE;
     }
 #endif
-    if ((cp = FindLeadingTilde(given, TRUE)) != 0
+    if ((cp = FindLeadingTilde(given, TRUE)) != given
 	&& (cp2 = wwwName(Home_Dir())) != 0
 	&& strlen(cp2) + strlen(given) < LY_MAXPATH) {
 	*(cp++) = '\0';
y?h=v1.9.2&id=69394f44516db77b126f997ca704bd77a3d76852'>^
6a5d09b8 ^
90dc5f6a ^
a8407dbf ^
6a5d09b8 ^






0b306138 ^
6a5d09b8 ^
65cb1a32 ^
9e63489a ^
f8e96a97 ^
9e63489a ^
9506fb8e ^

91e5b943 ^
0b306138 ^
6a5d09b8 ^
bd33933d ^
9506fb8e ^
3547d300 ^






9e63489a ^















9506fb8e ^
728fb838 ^
ea87d005 ^
67bb838c ^



91e5b943 ^
9506fb8e ^

728fb838 ^
5645f266 ^
ea87d005 ^
9506fb8e ^
1f62d7db ^


b4b0eb24 ^
1f62d7db ^

9506fb8e ^





1f62d7db ^







dd7a4f63 ^
1f62d7db ^
419e4aa5 ^

dd7a4f63 ^
1f62d7db ^
871c502d ^
9b83f114 ^
728fb838 ^
9b83f114 ^
871c502d ^
9b83f114 ^



ea87d005 ^
3201b163 ^
766a5b6a ^

3201b163 ^
ea87d005 ^
9506fb8e ^
728fb838 ^
3d566884 ^
9506fb8e ^


3201b163 ^


ea87d005 ^
a1274aba ^
eaaeed3d ^
a1274aba ^
9506fb8e ^
89660a64 ^
728fb838 ^
dd7a4f63 ^

419e4aa5 ^

dd7a4f63 ^

5599636d ^
419e4aa5 ^
ea87d005 ^
581cce8c ^
766a5b6a ^

581cce8c ^
45cb587d ^
728fb838 ^
4162b636 ^
bd33933d ^
45cb587d ^

728fb838 ^
4162b636 ^
cc952d63 ^

227f75db ^

9506fb8e ^
419e4aa5 ^
9506fb8e ^
e48e3c5c ^
3ea48208 ^
c6953a55 ^
3ea48208 ^
ecd0d386 ^



9506fb8e ^
766a5b6a ^
9506fb8e ^
766a5b6a ^
9506fb8e ^








3d566884 ^
9506fb8e ^


89660a64 ^
dd7a4f63 ^
9506fb8e ^
876e288a ^

766a5b6a ^

419e4aa5 ^
45cb587d ^
766a5b6a ^
45cb587d ^
227f75db ^

3ea48208 ^
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219