From: Kristen Carlson Accardi <kristen@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 1/5] ppp: fix segfault in pppcp_send_code_reject()
Date: Fri, 26 Mar 2010 18:34:26 -0700 [thread overview]
Message-ID: <1269653670-31352-2-git-send-email-kristen@linux.intel.com> (raw)
In-Reply-To: <1269653670-31352-1-git-send-email-kristen@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]
fix memory corruption caused by misplaced paren when memcpying
rejected packet data into Code-Reject packet.
---
gatchat/ppp_cp.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c
index 137f6b9..39e872b 100644
--- a/gatchat/ppp_cp.c
+++ b/gatchat/ppp_cp.c
@@ -454,9 +454,12 @@ static void pppcp_send_code_reject(struct pppcp_data *data,
guint8 *rejected_packet)
{
struct pppcp_packet *packet;
+ struct pppcp_packet *old_packet =
+ (struct pppcp_packet *) rejected_packet;
- packet = pppcp_packet_new(data, CODE_REJECT,
- ntohs(((struct pppcp_packet *) rejected_packet)->length));
+ pppcp_trace(data);
+
+ packet = pppcp_packet_new(data, CODE_REJECT, ntohs(old_packet->length));
/*
* Identifier must be changed for each Code-Reject sent
@@ -468,7 +471,7 @@ static void pppcp_send_code_reject(struct pppcp_data *data,
* truncated if it needs to be to comply with mtu requirement
*/
memcpy(packet->data, rejected_packet,
- ntohs(packet->length - CP_HEADER_SZ));
+ ntohs(packet->length) - CP_HEADER_SZ);
ppp_transmit(data->ppp, pppcp_to_ppp_packet(packet),
ntohs(packet->length));
--
1.6.6.1
next prev parent reply other threads:[~2010-03-27 1:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-27 1:34 [PATCH 0/5] ppp: error path fixes Kristen Carlson Accardi
2010-03-27 1:34 ` Kristen Carlson Accardi [this message]
2010-03-27 1:34 ` [PATCH 2/5] ppp: comment fix Kristen Carlson Accardi
2010-03-27 1:34 ` [PATCH 3/5] ppp: send Protocol-Reject Kristen Carlson Accardi
2010-03-27 1:34 ` [PATCH 4/5] ppp: use common code to get options from pppcp packet data Kristen Carlson Accardi
2010-03-27 1:34 ` [PATCH 5/5] ppp: handle Config-Reject Kristen Carlson Accardi
2010-03-27 2:29 ` [PATCH 0/5] ppp: error path fixes Marcel Holtmann
2010-03-27 4:39 ` Kristen Carlson Accardi
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=1269653670-31352-2-git-send-email-kristen@linux.intel.com \
--to=kristen@linux.intel.com \
--cc=ofono@ofono.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox