OLD | NEW |
1 /** | 1 /** |
2 * uri.c: set of generic URI related routines | 2 * uri.c: set of generic URI related routines |
3 * | 3 * |
4 * Reference: RFCs 3986, 2732 and 2373 | 4 * Reference: RFCs 3986, 2732 and 2373 |
5 * | 5 * |
6 * See Copyright for the status of this software. | 6 * See Copyright for the status of this software. |
7 * | 7 * |
8 * daniel@veillard.com | 8 * daniel@veillard.com |
9 */ | 9 */ |
10 | 10 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 * of the @uri structure | 318 * of the @uri structure |
319 * | 319 * |
320 * port = *DIGIT | 320 * port = *DIGIT |
321 * | 321 * |
322 * Returns 0 or the error code | 322 * Returns 0 or the error code |
323 */ | 323 */ |
324 static int | 324 static int |
325 xmlParse3986Port(xmlURIPtr uri, const char **str) | 325 xmlParse3986Port(xmlURIPtr uri, const char **str) |
326 { | 326 { |
327 const char *cur = *str; | 327 const char *cur = *str; |
| 328 unsigned port = 0; /* unsigned for defined overflow behavior */ |
328 | 329 |
329 if (ISA_DIGIT(cur)) { | 330 if (ISA_DIGIT(cur)) { |
330 unsigned port = 0; /* unsigned for defined overflow behavior */ | |
331 while (ISA_DIGIT(cur)) { | 331 while (ISA_DIGIT(cur)) { |
332 port = port * 10 + (*cur - '0'); | 332 port = port * 10 + (*cur - '0'); |
| 333 |
333 cur++; | 334 cur++; |
334 } | 335 } |
335 if (uri != NULL) | 336 if (uri != NULL) |
336 uri->port = port & INT_MAX; /* port value modulo INT_MAX+1 */ | 337 uri->port = port & INT_MAX; /* port value modulo INT_MAX+1 */ |
337 *str = cur; | 338 *str = cur; |
338 return(0); | 339 return(0); |
339 } | 340 } |
340 return(1); | 341 return(1); |
341 } | 342 } |
342 | 343 |
(...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 } | 2558 } |
2558 #endif | 2559 #endif |
2559 memset(&temp, 0, sizeof(temp)); | 2560 memset(&temp, 0, sizeof(temp)); |
2560 temp.path = (char *) cal; | 2561 temp.path = (char *) cal; |
2561 ret = xmlSaveUri(&temp); | 2562 ret = xmlSaveUri(&temp); |
2562 xmlFree(cal); | 2563 xmlFree(cal); |
2563 return(ret); | 2564 return(ret); |
2564 } | 2565 } |
2565 #define bottom_uri | 2566 #define bottom_uri |
2566 #include "elfgcchack.h" | 2567 #include "elfgcchack.h" |
OLD | NEW |