diff options
author | andrew hendry <andrew.hendry@gmail.com> | 2010-11-03 12:54:53 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-03 18:50:50 -0700 |
commit | a6331d6f9a4298173b413cf99a40cc86a9d92c37 (patch) | |
tree | b665efee7dae4472e0f4521bbdd3aef626813ba6 /net/x25/x25_facilities.c | |
parent | 41bb78b4b9adb21cf2c395b6b880aaae99c788b7 (diff) | |
download | linux-stable-a6331d6f9a4298173b413cf99a40cc86a9d92c37.tar.gz linux-stable-a6331d6f9a4298173b413cf99a40cc86a9d92c37.tar.bz2 linux-stable-a6331d6f9a4298173b413cf99a40cc86a9d92c37.zip |
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/x25_facilities.c')
-rw-r--r-- | net/x25/x25_facilities.c | 8 |
1 files changed, 4 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, case X25_FAC_CLASS_D: switch (*p) { case X25_FAC_CALLING_AE: - if (p[1] > X25_MAX_DTE_FACIL_LEN) - break; + if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) + return 0; dte_facs->calling_len = p[2]; memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); *vc_fac_mask |= X25_MASK_CALLING_AE; break; case X25_FAC_CALLED_AE: - if (p[1] > X25_MAX_DTE_FACIL_LEN) - break; + if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) + return 0; dte_facs->called_len = p[2]; memcpy(dte_facs->called_ae, &p[3], p[1] - 1); *vc_fac_mask |= X25_MASK_CALLED_AE; |