aboutsummaryrefslogtreecommitdiffstats
path: root/net/x25
diff options
context:
space:
mode:
authorandrew hendry <andrew.hendry@gmail.com>2010-11-03 08:54:53 -0400
committerDavid S. Miller <davem@davemloft.net>2010-11-03 21:50:50 -0400
commita6331d6f9a4298173b413cf99a40cc86a9d92c37 (patch)
treeb665efee7dae4472e0f4521bbdd3aef626813ba6 /net/x25
parent41bb78b4b9adb21cf2c395b6b880aaae99c788b7 (diff)
memory corruption in X.25 facilities parsing
Signed-of-by: Andrew Hendry <andrew.hendry@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/x25')
-rw-r--r--net/x25/x25_facilities.c8
-rw-r--r--net/x25/x25_in.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c
index 771bab00754b..3a8c4c419cd4 100644
--- a/net/x25/x25_facilities.c
+++ b/net/x25/x25_facilities.c
@@ -134,15 +134,15 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,
134 case X25_FAC_CLASS_D: 134 case X25_FAC_CLASS_D:
135 switch (*p) { 135 switch (*p) {
136 case X25_FAC_CALLING_AE: 136 case X25_FAC_CALLING_AE:
137 if (p[1] > X25_MAX_DTE_FACIL_LEN) 137 if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1)
138 break; 138 return 0;
139 dte_facs->calling_len = p[2]; 139 dte_facs->calling_len = p[2];
140 memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); 140 memcpy(dte_facs->calling_ae, &p[3], p[1] - 1);
141 *vc_fac_mask |= X25_MASK_CALLING_AE; 141 *vc_fac_mask |= X25_MASK_CALLING_AE;
142 break; 142 break;
143 case X25_FAC_CALLED_AE: 143 case X25_FAC_CALLED_AE:
144 if (p[1] > X25_MAX_DTE_FACIL_LEN) 144 if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1)
145 break; 145 return 0;
146 dte_facs->called_len = p[2]; 146 dte_facs->called_len = p[2];
147 memcpy(dte_facs->called_ae, &p[3], p[1] - 1); 147 memcpy(dte_facs->called_ae, &p[3], p[1] - 1);
148 *vc_fac_mask |= X25_MASK_CALLED_AE; 148 *vc_fac_mask |= X25_MASK_CALLED_AE;
diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c
index 63178961efac..f729f022be69 100644
--- a/net/x25/x25_in.c
+++ b/net/x25/x25_in.c
@@ -119,6 +119,8 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp
119 &x25->vc_facil_mask); 119 &x25->vc_facil_mask);
120 if (len > 0) 120 if (len > 0)
121 skb_pull(skb, len); 121 skb_pull(skb, len);
122 else
123 return -1;
122 /* 124 /*
123 * Copy any Call User Data. 125 * Copy any Call User Data.
124 */ 126 */