From 8402740acdc4c9bb4c96e23c8fd043d474d15706 Mon Sep 17 00:00:00 2001
From: unknown <msvensson@pilot.mysql.com>
Date: Fri, 11 Apr 2008 10:30:06 +0200
Subject: [PATCH] Bug#35986 valgrind warning in DbugParse for empty string in
 SET GLOBAL DEBUG=""  - Code in DbugParse was reading from beyond end of the
 control string

dbug/dbug.c:
  Don't try to parse control strings that hasn't got any tokens
  or is zero size
---
 dbug/dbug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dbug/dbug.c b/dbug/dbug.c
index 666ab2b3e3..1cebbbcf72 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -493,7 +493,7 @@ static void DbugParse(CODE_STATE *cs, const char *control)
   }
 
   end= DbugStrTok(control);
-  while (1)
+  while (control < end)
   {
     int c, sign= (*control == '+') ? 1 : (*control == '-') ? -1 : 0;
     if (sign) control++;
-- 
2.30.9