DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] cfgfile: fix integer overflow
@ 2016-04-22 10:41 Michal Kobylinski
  2016-04-22 16:23 ` Stephen Hemminger
  2016-04-28 11:09 ` Dumitrescu, Cristian
  0 siblings, 2 replies; 6+ messages in thread
From: Michal Kobylinski @ 2016-04-22 10:41 UTC (permalink / raw)
  To: cristian.dumitrescu, dev; +Cc: Michal Kobylinski

Fix issue reported by Coverity.

Coverity ID 13289: Integer overflowed argument: The argument will be too
small or even negative, likely resulting in unexpected behavior (for
example, under-allocation in a memory allocation function).
In rte_cfgfile_load: An integer overflow occurs, with the overflowed
value used as an argument to a function

Fixes: eaafbad419bf ("cfgfile: library to interpret config files")

Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
---
 lib/librte_cfgfile/rte_cfgfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c
index 75625a2..0a5a279 100644
--- a/lib/librte_cfgfile/rte_cfgfile.c
+++ b/lib/librte_cfgfile/rte_cfgfile.c
@@ -135,7 +135,7 @@ rte_cfgfile_load(const char *filename, int flags)
 				goto error1;
 			}
 			*end = '\0';
-			_strip(&buffer[1], end - &buffer[1]);
+			_strip(&buffer[1], (unsigned)(end - &buffer[1]));
 
 			/* close off old section and add start new one */
 			if (curr_section >= 0)
-- 
1.9.1

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

end of thread, other threads:[~2016-05-16 12:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-22 10:41 [dpdk-dev] [PATCH] cfgfile: fix integer overflow Michal Kobylinski
2016-04-22 16:23 ` Stephen Hemminger
2016-04-28 11:09 ` Dumitrescu, Cristian
2016-05-16 10:05   ` Thomas Monjalon
2016-05-16 12:50     ` Kobylinski, MichalX
2016-05-16 12:58       ` Mcnamara, John

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