summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/rr.c b/rr.c
index 40fdad19..e52ea809 100644
--- a/rr.c
+++ b/rr.c
@@ -670,14 +670,19 @@ ldns_rr_new_question_frm_str(ldns_rr **newrr, const char *str,
true);
}
+/* Strip whitespace from the start and the end of <line>. */
static char *
ldns_strip_ws(char *line)
{
char *s = line, *e;
- for (s = line; *s && isspace(*s); s++);
- for (e = strchr(s, 0); e-2 > s && isspace(e[-1]) && e[-2] != '\\'; e--);
+ for (s = line; *s && isspace(*s); s++)
+ ;
+
+ for (e = strchr(s, 0); e > s+2 && isspace(e[-1]) && e[-2] != '\\'; e--)
+ ;
*e = 0;
+
return s;
}