dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fixed buffer overrun in handling log messages
@ 2013-05-01 18:50 Han, Dongsu
       [not found] ` <CAAYH+dX-4W-ZbmVEogRLMdy0KtT7iG249m18S7inp5TNW0j67g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Han, Dongsu @ 2013-05-01 18:50 UTC (permalink / raw)
  To: dev-VfR2kkLFssw


[-- 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);

[-- Attachment #3: Type: text/plain, Size: 130 bytes --]

_______________________________________________
dev mailing list
dev-VfR2kkLFssw@public.gmane.org
http://dpdk.org/ml/listinfo/dev

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-03 16:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-01 18:50 [PATCH] fixed buffer overrun in handling log messages Han, Dongsu
     [not found] ` <CAAYH+dX-4W-ZbmVEogRLMdy0KtT7iG249m18S7inp5TNW0j67g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-02  8:24   ` Olivier MATZ
     [not found]     ` <518222B1.9050003-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-05-02  9:18       ` Olivier MATZ
     [not found]         ` <51822F49.5040406-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-05-02  9:22           ` eal/log: fix memory corruption Olivier Matz
     [not found]             ` <1367486557-8589-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-05-03 16:37               ` Thomas Monjalon

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).