Fix bad deref of memory in parser
authorJens Axboe <jaxboe@fusionio.com>
Thu, 29 Jul 2010 08:50:05 +0000 (10:50 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Thu, 29 Jul 2010 08:50:05 +0000 (10:50 +0200)
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
parse.c

diff --git a/parse.c b/parse.c
index d8061610a8a92563c3701b02e8e7ee305f480ee5..db2f5a42f85aa68b5c7e768f0dee5f2be14cef2a 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -169,6 +169,9 @@ static unsigned long long get_mult_bytes(const char *str, int len, void *data)
 {
        const char *p;
 
+       if (len < 2)
+               return __get_mult_bytes(str, data);
+
        /*
         * if the last char is 'b' or 'B', the user likely used
         * "1gb" instead of just "1g". If the second to last is also