Merge git://git.linux-xtensa.org/kernel/xtensa-feed
[sfrench/cifs-2.6.git] / net / netfilter / nf_conntrack_sip.c
index eb2a2411f97b9863a1fe7ebb42e43bf4e2897bd3..7aaa8c91b2938f4ac2872ed2002ccf97d2806390 100644 (file)
@@ -303,10 +303,16 @@ static int skp_epaddr_len(struct nf_conn *ct, const char *dptr,
 {
        int s = *shift;
 
-       for (; dptr <= limit && *dptr != '@'; dptr++)
+       /* Search for @, but stop at the end of the line.
+        * We are inside a sip: URI, so we don't need to worry about
+        * continuation lines. */
+       while (dptr <= limit &&
+              *dptr != '@' && *dptr != '\r' && *dptr != '\n') {
                (*shift)++;
+               dptr++;
+       }
 
-       if (*dptr == '@') {
+       if (dptr <= limit && *dptr == '@') {
                dptr++;
                (*shift)++;
        } else
@@ -335,7 +341,7 @@ int ct_sip_get_info(struct nf_conn *ct,
                        continue;
                }
                aux = ct_sip_search(hnfo->ln_str, dptr, hnfo->ln_strlen,
-                                   ct_sip_lnlen(dptr, limit),
+                                   ct_sip_lnlen(dptr, limit),
                                    hnfo->case_sensitive);
                if (!aux) {
                        DEBUGP("'%s' not found in '%s'.\n", hnfo->ln_str,
@@ -445,12 +451,12 @@ static int sip_help(struct sk_buff **pskb,
 
                /* We'll drop only if there are parse problems. */
                if (!parse_addr(ct, dptr + matchoff, NULL, &addr,
-                               dptr + datalen)) {
+                               dptr + datalen)) {
                        ret = NF_DROP;
                        goto out;
                }
                if (ct_sip_get_info(ct, dptr, datalen, &matchoff, &matchlen,
-                                   POS_MEDIA) > 0) {
+                                   POS_MEDIA) > 0) {
 
                        port = simple_strtoul(dptr + matchoff, NULL, 10);
                        if (port < 1024) {