From 4521a962d2b309a7afcd93bf260c73fd460e0e8c Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 17 Nov 2008 02:58:32 +0000 Subject: [PATCH] backporting 1494, osrf_buffer_add_char patch to append nul byte git-svn-id: svn://svn.open-ils.org/OpenSRF/branches/rel_1_0@1495 9efc2488-bf62-4759-914b-345cdb29e865 --- include/opensrf/utils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/opensrf/utils.h b/include/opensrf/utils.h index f6cb272..f8fc04c 100644 --- a/include/opensrf/utils.h +++ b/include/opensrf/utils.h @@ -69,8 +69,10 @@ GNU General Public License for more details. #define OSRF_BUFFER_ADD_CHAR(gb, c)\ do {\ if(gb) {\ - if(gb->n_used < gb->size - 1)\ + if(gb->n_used < gb->size - 1) {\ gb->buf[gb->n_used++] = c;\ + gb->buf[gb->n_used] = '\0';\ + }\ else\ buffer_add_char(gb, c);\ }\ @@ -207,7 +209,7 @@ long va_list_size(const char* format, va_list); char* va_list_to_string(const char* format, ...); -/* string escape utility method. escapes unicode embeded characters. +/* string escape utility method. escapes unicode embedded characters. escapes the usual \n, \t, etc. for example, if you provide a string like so: -- 2.11.0