summaryrefslogtreecommitdiff
path: root/nuttx/tools
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-04-23 11:25:52 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-04-23 11:25:52 -0600
commit663c80136e271c9a20ab7d820448334ac572275e (patch)
tree33e15ec30279618e9a68a2307b4c5ca42585e3c0 /nuttx/tools
parentdf133721e178440d9cdf87c942a216a1c2cedba0 (diff)
downloadpx4-nuttx-663c80136e271c9a20ab7d820448334ac572275e.tar.gz
px4-nuttx-663c80136e271c9a20ab7d820448334ac572275e.tar.bz2
px4-nuttx-663c80136e271c9a20ab7d820448334ac572275e.zip
kconfig2html: Fix some handling of empty strings
Diffstat (limited to 'nuttx/tools')
-rw-r--r--nuttx/tools/kconfig2html.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/nuttx/tools/kconfig2html.c b/nuttx/tools/kconfig2html.c
index e29fd4788..f6d21091a 100644
--- a/nuttx/tools/kconfig2html.c
+++ b/nuttx/tools/kconfig2html.c
@@ -522,11 +522,12 @@ static char *htmlize_text(const char *src)
{
char *dest = g_scratch;
- /* We may get here with the source pointer equal to NULL. Return the
+ /* We may get here with the source pointer equal to NULL (or a pointer to
+ * a NUL string). Return the
* disfavor.
*/
- if (!src)
+ if (!src || !*src)
{
return NULL;
}
@@ -955,6 +956,7 @@ static char *get_html_string(void)
{
char *pbegin;
char *pend;
+ int len;
/* Search for the leading quotation mark in the line buffer */
@@ -990,11 +992,21 @@ static char *get_html_string(void)
}
else
{
+ /* Get the length of the string. Return NULL if all that is
+ * left on the line is a NUL string.
+ */
+
+ len = strlen(pbegin);
+ if (len < 1)
+ {
+ return NULL;
+ }
+
/* Use the rest of the line. g_lnptr is set to point at the
* terminating NUL.
*/
- pend = pbegin + strlen(pbegin);
+ pend = pbegin + len;
g_lnptr = pend;
}