summaryrefslogtreecommitdiffstats
path: root/input.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-08 21:22:01 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-08 21:22:01 +0000
commit4ebb85aae8b5d931228151ccf62b768dd5a2ff8c (patch)
tree1c11eeccf3bf69cfce415931ab703c82764bdaa0 /input.c
parented5e8c4cd960f6693c3e2f086b909aed6d4edb94 (diff)
Don't return NULL when retrieving a string that is too long.
Diffstat (limited to 'input.c')
-rw-r--r--input.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/input.c b/input.c
index 1d9f529b..3a4057fb 100644
--- a/input.c
+++ b/input.c
@@ -1,4 +1,4 @@
-/* $Id: input.c,v 1.70 2009-01-07 22:52:33 nicm Exp $ */
+/* $Id: input.c,v 1.71 2009-01-08 21:22:01 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -202,10 +202,9 @@ input_get_string(struct input_ctx *ictx)
{
char *s;
- if (ictx->string_buf == NULL)
+ if (ictx->string_buf == NULL || input_add_string(ictx, '\0') != 0)
return (xstrdup(""));
- input_add_string(ictx, '\0');
s = ictx->string_buf;
ictx->string_buf = NULL;
return (s);