aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@src.gnome.org>2004-06-26 03:06:25 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-06-26 03:06:25 +0800
commitc04a0ac796b1bf878746e3fecf0ec231eb5d0e3f (patch)
tree32f2a2121e86df4bf8f21266e9e6a0bb48f61811 /camel
parentbceb25b9a0dddf8c97521e9e52b79857afdaea34 (diff)
downloadgsoc2013-evolution-c04a0ac796b1bf878746e3fecf0ec231eb5d0e3f.tar
gsoc2013-evolution-c04a0ac796b1bf878746e3fecf0ec231eb5d0e3f.tar.gz
gsoc2013-evolution-c04a0ac796b1bf878746e3fecf0ec231eb5d0e3f.tar.bz2
gsoc2013-evolution-c04a0ac796b1bf878746e3fecf0ec231eb5d0e3f.tar.lz
gsoc2013-evolution-c04a0ac796b1bf878746e3fecf0ec231eb5d0e3f.tar.xz
gsoc2013-evolution-c04a0ac796b1bf878746e3fecf0ec231eb5d0e3f.tar.zst
gsoc2013-evolution-c04a0ac796b1bf878746e3fecf0ec231eb5d0e3f.zip
fixed an uninitialised memory read from my last fix
svn path=/trunk/; revision=26524
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-url-scanner.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/camel/camel-url-scanner.c b/camel/camel-url-scanner.c
index 466cec3a15..e1b63b27d8 100644
--- a/camel/camel-url-scanner.c
+++ b/camel/camel-url-scanner.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif
+#include <stdio.h>
#include <string.h>
#include <ctype.h>
@@ -329,12 +330,15 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_
const char *save;
char close_brace;
+ fprintf (stderr, "camel_url_web_end(%s): %.*s\n", match->pattern, inend - pos, pos);
+
inptr += strlen (match->pattern);
close_brace = url_stop_at_brace (in, match->um_so);
/* find the end of the domain */
if (is_digit (*inptr)) {
+ domain_literal:
/* domain-literal */
do {
digits = 0;
@@ -353,6 +357,8 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_
} while (parts < 4);
} else if (is_atom (*inptr)) {
/* might be a domain or user@domain */
+ fprintf (stderr, "found atom (user@domain?)...\n");
+ save = inptr;
while (inptr < inend) {
if (!is_atom (*inptr))
break;
@@ -362,7 +368,7 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_
while (inptr < inend && is_atom (*inptr))
inptr++;
- if (inptr < inend && *inptr == '.' && is_atom (inptr[1]))
+ if ((inptr + 1) < inend && *inptr == '.' && is_atom (inptr[1]))
inptr++;
}
@@ -383,7 +389,7 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_
while (inptr < inend && is_domain (*inptr))
inptr++;
- if (inptr < inend && *inptr == '.' && is_domain (inptr[1]))
+ if ((inptr + 1) < inend && *inptr == '.' && is_domain (inptr[1]))
inptr++;
}
} else {
@@ -396,13 +402,13 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_
inptr++;
if (is_digit (*inptr) || passwd) {
- port = 0;
+ port = (*inptr++ - '0');
while (inptr < inend && is_digit (*inptr) && port < 65536)
port = (port * 10) + (*inptr++ - '0');
if (port >= 65536) {
- if (!passwd) {
+ if (!passwd && inptr < inend) {
/* this must be a password? */
goto passwd;
}
@@ -417,15 +423,16 @@ camel_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_
while (inptr < inend && is_atom (*inptr))
inptr++;
- if (inptr < inend) {
+ if ((inptr + 2) < inend) {
if (*inptr == '@') {
- /* there should be a domain next */
inptr++;
- goto domain;
- } else {
- /* no idea what this is... so don't keep it */
- inptr = save;
+ if (is_digit (*inptr))
+ goto domain_literal;
+ else if (is_domain (*inptr))
+ goto domain;
}
+
+ return FALSE;
}
}