View | Details | Raw Unified | Return to bug 64362
Collapse All | Expand All

(-)file_not_specified_in_diff (-14 / +23 lines)
Line  Link Here
0
-- libxml-1.8.17.orig/nanoftp.c
0
++ libxml-1.8.17/nanoftp.c
Lines 65-70 Link Here
65
#define FTP_GET_PASSWD		331
65
#define FTP_GET_PASSWD		331
66
#define FTP_BUF_SIZE		512
66
#define FTP_BUF_SIZE		512
67
67
68
#define XML_NANO_MAX_URLBUF	4096
69
68
typedef struct xmlNanoFTPCtxt {
70
typedef struct xmlNanoFTPCtxt {
69
    char *protocol;	/* the protocol name */
71
    char *protocol;	/* the protocol name */
70
    char *hostname;	/* the host name */
72
    char *hostname;	/* the host name */
Lines 203-209 Link Here
203
xmlNanoFTPScanURL(void *ctx, const char *URL) {
205
xmlNanoFTPScanURL(void *ctx, const char *URL) {
204
    xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
206
    xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
205
    const char *cur = URL;
207
    const char *cur = URL;
206
    char buf[4096];
208
    char buf[XML_NANO_MAX_URLBUF];
207
    int index = 0;
209
    int index = 0;
208
    int port = 0;
210
    int port = 0;
209
211
Lines 221-227 Link Here
221
    }
223
    }
222
    if (URL == NULL) return;
224
    if (URL == NULL) return;
223
    buf[index] = 0;
225
    buf[index] = 0;
224
    while (*cur != 0) {
226
    while ((*cur != 0) && (index < XML_NANO_MAX_URLBUF - 1)) {
225
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
227
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
226
	    buf[index] = 0;
228
	    buf[index] = 0;
227
	    ctxt->protocol = xmlMemStrdup(buf);
229
	    ctxt->protocol = xmlMemStrdup(buf);
Lines 234-240 Link Here
234
    if (*cur == 0) return;
236
    if (*cur == 0) return;
235
237
236
    buf[index] = 0;
238
    buf[index] = 0;
237
    while (1) {
239
    while (index < XML_NANO_MAX_URLBUF - 1) {
238
        if (cur[0] == ':') {
240
        if (cur[0] == ':') {
239
	    buf[index] = 0;
241
	    buf[index] = 0;
240
	    ctxt->hostname = xmlMemStrdup(buf);
242
	    ctxt->hostname = xmlMemStrdup(buf);
Lines 263-269 Link Here
263
    else {
265
    else {
264
        index = 0;
266
        index = 0;
265
        buf[index] = 0;
267
        buf[index] = 0;
266
	while (*cur != 0)
268
	while ((*cur != 0) && (index < XML_NANO_MAX_URLBUF-1))
267
	    buf[index++] = *cur++;
269
	    buf[index++] = *cur++;
268
	buf[index] = 0;
270
	buf[index] = 0;
269
	ctxt->path = xmlMemStrdup(buf);
271
	ctxt->path = xmlMemStrdup(buf);
Lines 288-294 Link Here
288
xmlNanoFTPUpdateURL(void *ctx, const char *URL) {
290
xmlNanoFTPUpdateURL(void *ctx, const char *URL) {
289
    xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
291
    xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
290
    const char *cur = URL;
292
    const char *cur = URL;
291
    char buf[4096];
293
    char buf[XML_NANO_MAX_URLBUF];
292
    int index = 0;
294
    int index = 0;
293
    int port = 0;
295
    int port = 0;
294
296
Lines 301-307 Link Here
301
    if (ctxt->hostname == NULL)
303
    if (ctxt->hostname == NULL)
302
	return(-1);
304
	return(-1);
303
    buf[index] = 0;
305
    buf[index] = 0;
304
    while (*cur != 0) {
306
    while ((*cur != 0) && (index < XML_NANO_MAX_URLBUF-1)) {
305
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
307
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
306
	    buf[index] = 0;
308
	    buf[index] = 0;
307
	    if (strcmp(ctxt->protocol, buf))
309
	    if (strcmp(ctxt->protocol, buf))
Lines 353-359 Link Here
353
    else {
355
    else {
354
        index = 0;
356
        index = 0;
355
        buf[index] = 0;
357
        buf[index] = 0;
356
	while (*cur != 0)
358
	while ((*cur != 0) && (index < XML_NANO_MAX_URLBUF-1))
357
	    buf[index++] = *cur++;
359
	    buf[index++] = *cur++;
358
	buf[index] = 0;
360
	buf[index] = 0;
359
	ctxt->path = xmlMemStrdup(buf);
361
	ctxt->path = xmlMemStrdup(buf);
Lines 374-380 Link Here
374
void
376
void
375
xmlNanoFTPScanProxy(const char *URL) {
377
xmlNanoFTPScanProxy(const char *URL) {
376
    const char *cur = URL;
378
    const char *cur = URL;
377
    char buf[4096];
379
    char buf[XML_NANO_MAX_URLBUF];
378
    int index = 0;
380
    int index = 0;
379
    int port = 0;
381
    int port = 0;
380
382
Lines 393-399 Link Here
393
#endif
395
#endif
394
    if (URL == NULL) return;
396
    if (URL == NULL) return;
395
    buf[index] = 0;
397
    buf[index] = 0;
396
    while (*cur != 0) {
398
    while ((*cur != 0) && (index < XML_NANO_MAX_URLBUF-1)) {
397
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
399
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
398
	    buf[index] = 0;
400
	    buf[index] = 0;
399
	    index = 0;
401
	    index = 0;
Lines 828-833 Link Here
828
    if (hp == NULL)
830
    if (hp == NULL)
829
        return(-1);
831
        return(-1);
830
832
833
    if ((unsigned int) hp->h_length >
834
	sizeof(((struct sockaddr_in *)&ctxt->ftpAddr)->sin_addr)) {
835
	return (-1);
836
    }
837
831
    /*
838
    /*
832
     * Prepare the socket
839
     * Prepare the socket
833
     */
840
     */
834
-- libxml-1.8.17.orig/nanohttp.c
841
++ libxml-1.8.17/nanohttp.c
Lines 161-166 Link Here
161
    const char *cur = URL;
161
    const char *cur = URL;
162
    char buf[4096];
162
    char buf[4096];
163
    int index = 0;
163
    int index = 0;
164
    const int indexMax = 4096 - 1;
164
    int port = 0;
165
    int port = 0;
165
166
166
    if (ctxt->protocol != NULL) { 
167
    if (ctxt->protocol != NULL) { 
Lines 177-183 Link Here
177
    }
178
    }
178
    if (URL == NULL) return;
179
    if (URL == NULL) return;
179
    buf[index] = 0;
180
    buf[index] = 0;
180
    while (*cur != 0) {
181
    while ((*cur != 0) && (index < indexMax)) {
181
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
182
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
182
	    buf[index] = 0;
183
	    buf[index] = 0;
183
	    ctxt->protocol = xmlMemStrdup(buf);
184
	    ctxt->protocol = xmlMemStrdup(buf);
Lines 219-225 Link Here
219
    else {
220
    else {
220
        index = 0;
221
        index = 0;
221
        buf[index] = 0;
222
        buf[index] = 0;
222
	while (*cur != 0)
223
	while ((*cur != 0) && (index < indexMax))
223
	    buf[index++] = *cur++;
224
	    buf[index++] = *cur++;
224
	buf[index] = 0;
225
	buf[index] = 0;
225
	ctxt->path = xmlMemStrdup(buf);
226
	ctxt->path = xmlMemStrdup(buf);
Lines 241-246 Link Here
241
    const char *cur = URL;
242
    const char *cur = URL;
242
    char buf[4096];
243
    char buf[4096];
243
    int index = 0;
244
    int index = 0;
245
    const int indexMax = 4096 - 1;
244
    int port = 0;
246
    int port = 0;
245
247
246
    if (proxy != NULL) { 
248
    if (proxy != NULL) { 
Lines 258-264 Link Here
258
#endif
260
#endif
259
    if (URL == NULL) return;
261
    if (URL == NULL) return;
260
    buf[index] = 0;
262
    buf[index] = 0;
261
    while (*cur != 0) {
263
    while ((*cur != 0) && (index < indexMax)) {
262
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
264
        if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
263
	    buf[index] = 0;
265
	    buf[index] = 0;
264
	    index = 0;
266
	    index = 0;

Return to bug 64362