|
From: <sv...@va...> - 2013-01-21 22:05:56
|
philippe 2013-01-21 22:05:47 +0000 (Mon, 21 Jan 2013)
New Revision: 13257
Log:
Fix NULL dereference if no integer arg given to monitor block_list cmd
Reported by Florian (spotted by coverity).
Modified files:
trunk/memcheck/mc_main.c
Modified: trunk/memcheck/mc_main.c (+4 -3)
===================================================================
--- trunk/memcheck/mc_main.c 2013-01-21 20:38:54 +00:00 (rev 13256)
+++ trunk/memcheck/mc_main.c 2013-01-21 22:05:47 +00:00 (rev 13257)
@@ -5386,9 +5386,10 @@
HChar *endptr;
UInt lr_nr = 0;
wl = VG_(strtok_r) (NULL, " ", &ssaveptr);
- lr_nr = VG_(strtoull10) (wl, &endptr);
- if (wl != NULL && *endptr != '\0') {
- VG_(gdb_printf) ("malformed integer\n");
+ if (wl != NULL)
+ lr_nr = VG_(strtoull10) (wl, &endptr);
+ if (wl == NULL || *endptr != '\0') {
+ VG_(gdb_printf) ("malformed or missing integer\n");
} else {
// lr_nr-1 as what is shown to the user is 1 more than the index in lr_array.
if (lr_nr == 0 || ! MC_(print_block_list) (lr_nr-1))
|