bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add missing check for return value from strchr()


From: Petr Písař
Subject: [PATCH] Add missing check for return value from strchr()
Date: Thu, 28 Apr 2011 18:30:25 +0200

Small bug in bundled texinfo2man: If there is no new line, NULL is
returned and NULL would be used in next for-cycle.
---
 man/texinfo2man.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/man/texinfo2man.c b/man/texinfo2man.c
index 81855a6..792210e 100644
--- a/man/texinfo2man.c
+++ b/man/texinfo2man.c
@@ -448,6 +448,10 @@ int main(
                               indentation += 5;
                               printf (".nf\n.na\n");
                               q = strchr (q, '\n');
+                              if (!q)
+                              {
+                                 break;
+                              }
                               ++line_no;
                               continue;
                            }
-- 
1.7.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]