X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsnprintf.c;h=de918f10c6113ed7cbc8af0a39c2c836c39cbea3;hp=0221f977b31cd1ed6ae078e3986fbc6fafe2856e;hb=5ae134cc01cf31868aa2adaa7daf801993e7c1e3;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0 diff --git a/src/snprintf.c b/src/snprintf.c index 0221f97..de918f1 100644 --- a/src/snprintf.c +++ b/src/snprintf.c @@ -1,11 +1,14 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ /** * \file snprintf.c * \brief snprintf wrapper */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -17,7 +20,8 @@ void yaz_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap) vsnprintf(buf, size, fmt, ap); #else #ifdef WIN32 - _vsnprintf(buf, size, fmt, ap); + _vsnprintf(buf, size-1, fmt, ap); + buf[size-1] = '\0'; #else vsprintf(buf, fmt, ap); #endif @@ -35,6 +39,7 @@ void yaz_snprintf(char *buf, size_t size, const char *fmt, ...) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab