From: Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] Fix stack overflow
References: 351625

This patch fixes a stack overflow in tools.c, function xxd().
While the string indeed expands to 49 characters, the terminating zero needs
one character so that the buffer must be 50 characters large.


Signed-off-by: Bernhard Walle <bwalle@suse.de>

---
 tools.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/tools.c
+++ b/tools.c
@@ -163,7 +163,7 @@ char * strip(char * s) {
 
 void xxd(unsigned char * bytes, int size, int loglevel) {
      int i,pos;
-     char out_line[49];
+     char out_line[50];
          
      for (i=0;i<=((size-1) / 16);i++) {
           sprintf(out_line, "%06X0: %02X%02X %02X%02X %02X%02X %02X%02X %02X%02X %02X%02X %02X%02X %02X%02X\n", i,
