Ensure we leave room for the trailing NUL
authorAlan T. DeKok <aland@freeradius.org>
Thu, 9 Sep 2010 12:33:03 +0000 (14:33 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 9 Sep 2010 13:29:00 +0000 (15:29 +0200)
src/main/conffile.c

index 4feed80..ee47afb 100644 (file)
@@ -2589,7 +2589,7 @@ int cf_pair2xml(FILE *fp, const CONF_PAIR *cp)
                char *p = buffer;
                const char *q = cp->value;
 
-               while (*q && (p < (buffer + sizeof(buffer)))) {
+               while (*q && (p < (buffer + sizeof(buffer) - 1))) {
                        if (q[0] == '&') {
                                memcpy(p, "&amp;", 4);
                                p += 5;