[PATCH] End comment detection at end of string

Chris Butler chrisb at debian.org
Sat Jun 5 12:45:31 UTC 2010


This prevents an endless loop when a statement ends with a comment and
no newline.

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584428 for details.
---
 dbdimp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dbdimp.c b/dbdimp.c
index e473a77..aff25a6 100755
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -595,12 +595,12 @@ static char *parse_params(
         *ptr++ = *statement_ptr++;
         if  (*statement_ptr == '-')
         {
-          /* ignore everything until newline */
+          /* ignore everything until newline or end of string */
           while (*statement_ptr)
           {
             comment_length++;
             *ptr++ = *statement_ptr++;
-            if (*statement_ptr == '\n')
+            if (!*statement_ptr || *statement_ptr == '\n')
             {
               comment_end= true;
               break;
-- 
1.7.1


--uAKRQypu60I7Lcqm--





More information about the pkg-perl-maintainers mailing list