Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-drm-fsl-dcu.git] / net / ipv4 / netfilter / ip_conntrack_sip.c
index 3a26d63eed88926b81baf934a002314c823217b9..c59a962c1f61c2c415b2e6ff7b12de755fa72864 100644 (file)
@@ -283,10 +283,16 @@ static int skp_epaddr_len(const char *dptr, const char *limit, int *shift)
 {
        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
@@ -315,7 +321,7 @@ int ct_sip_get_info(const char *dptr, size_t dlen,
                        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,
@@ -400,7 +406,7 @@ static int sip_help(struct sk_buff **pskb,
        if (dataoff >= (*pskb)->len) {
                DEBUGP("skb->len = %u\n", (*pskb)->len);
                return NF_ACCEPT;
-        }
+       }
 
        ip_ct_refresh(ct, *pskb, sip_timeout * HZ);
 
@@ -433,16 +439,16 @@ static int sip_help(struct sk_buff **pskb,
        }
        /* Get ip and port address from SDP packet. */
        if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen,
-                           POS_CONNECTION) > 0) {
+                           POS_CONNECTION) > 0) {
 
                /* We'll drop only if there are parse problems. */
                if (parse_ipaddr(dptr + matchoff, NULL, &ipaddr,
-                                dptr + datalen) < 0) {
+                                dptr + datalen) < 0) {
                        ret = NF_DROP;
                        goto out;
                }
                if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen,
-                                   POS_MEDIA) > 0) {
+                                   POS_MEDIA) > 0) {
 
                        port = simple_strtoul(dptr + matchoff, NULL, 10);
                        if (port < 1024) {