From: Chen Gang <gang.chen@asianux.com>
To: Jiri Kosina <jkosina@suse.cz>,
isdn@linux-pingi.de, Jiri Slaby <jslaby@suse.cz>,
Greg KH <gregkh@linuxfoundation.org>
Cc: alan@linux.intel.com, netdev <netdev@vger.kernel.org>
Subject: [PATCH] drivers/isdn: checkng length to be sure not memory overflow
Date: Wed, 27 Feb 2013 17:05:14 +0800 [thread overview]
Message-ID: <512DCC4A.6060106@asianux.com> (raw)
the length of cmd.parm.cmsg.para is 50 (MAX_CAPI_PARA_LEN).
the strlen(msg) may be more than 50 (Modem-Commandbuffer, less than 255).
isdn_tty_send_msg is called by isdn_tty_parse_at
the relative parameter is m->mdmcmd (atemu *m)
the relative command may be "+M..."
so need check the length to be sure not memory overflow.
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
drivers/isdn/i4l/isdn_tty.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index d8a7d83..c3f0f99 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -902,7 +902,7 @@ isdn_tty_send_msg(modem_info *info, atemu *m, char *msg)
int j;
int l;
- l = strlen(msg);
+ l = min(strlen(msg), sizeof(cmd.parm.cmsg.para) - 2);
if (!l) {
isdn_tty_modem_result(RESULT_ERROR, info);
return;
--
1.7.7.6
next reply other threads:[~2013-02-27 9:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-27 9:05 Chen Gang [this message]
2013-02-27 9:48 ` [PATCH] drivers/isdn: checkng length to be sure not memory overflow Jiri Slaby
2013-02-27 10:25 ` Chen Gang
2013-02-27 10:44 ` Jiri Slaby
2013-02-28 1:45 ` Chen Gang
2013-02-28 10:00 ` Jiri Slaby
2013-02-28 11:01 ` Chen Gang
2013-02-28 13:43 ` Jiri Slaby
2013-03-05 2:20 ` Chen Gang
2013-03-05 9:34 ` Jiri Slaby
2013-03-07 4:13 ` Chen Gang
2013-03-08 4:25 ` [PATCH v2] " Chen Gang
2013-03-08 5:36 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=512DCC4A.6060106@asianux.com \
--to=gang.chen@asianux.com \
--cc=alan@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=isdn@linux-pingi.de \
--cc=jkosina@suse.cz \
--cc=jslaby@suse.cz \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.