DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Han, Dongsu" <dongsuh@cs.cmu.edu>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] fixed buffer overrun in handling log messages
Date: Wed, 1 May 2013 14:50:57 -0400	[thread overview]
Message-ID: <CAAYH+dX-4W-ZbmVEogRLMdy0KtT7iG249m18S7inp5TNW0j67g@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 102 bytes --]

 I'm sending a proposed patch to fix the buffer overrun problem in handling
log messages.

Dongsu Han

[-- Attachment #1.2: Type: text/html, Size: 170 bytes --]

[-- Attachment #2: dpdk-patch.diff --]
[-- Type: application/octet-stream, Size: 562 bytes --]

diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index 1362109..5395078 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -204,7 +204,7 @@ rte_log_add_in_history(const char *buf, size_t size)
 
 	/* add in history */
 	memcpy(hist_buf->buf, buf, size);
-	hist_buf->buf[LOG_ELT_SIZE-1] = '\0';
+	hist_buf->buf[LOG_ELT_SIZE-1- sizeof(*hist_buf)] = '\0';
 	hist_buf->size = size;
 	STAILQ_INSERT_TAIL(&log_history, hist_buf, next);
 	rte_spinlock_unlock(&log_list_lock);

             reply	other threads:[~2013-05-01 18:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 18:50 Han, Dongsu [this message]
2013-05-02  8:24 ` Olivier MATZ
2013-05-02  9:18   ` Olivier MATZ
2013-05-02  9:22     ` [dpdk-dev] eal/log: fix memory corruption Olivier Matz
2013-05-03 16:37       ` Thomas Monjalon

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=CAAYH+dX-4W-ZbmVEogRLMdy0KtT7iG249m18S7inp5TNW0j67g@mail.gmail.com \
    --to=dongsuh@cs.cmu.edu \
    --cc=dev@dpdk.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;
as well as URLs for NNTP newsgroup(s).