common/util.c, server/admin.c: Ensure null-termination of result strings.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 23 Apr 2017 03:06:07 +0000 (04:06 +0100)
`dstr_putc' has a sharp edge here.  Apparently I wasn't careful enough.

common/util.c
server/admin.c

index 78358b3..3de554d 100644 (file)
@@ -70,6 +70,7 @@ void u_quotify(dstr *d, const char *p)
     }
     dstr_putc(d, '\"');
   }
+  dstr_putz(d);
 }
 
 /* --- @u_getuser@ --- *
index 3257c7d..06922db 100644 (file)
@@ -311,6 +311,7 @@ void a_vformat(dstr *d, const char *fmt, va_list *ap)
     }
     fmt = va_arg(*ap, const char *);
   }
+  dstr_putz(d);
 
   dstr_destroy(&dd);
 }