X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsnprintf.c;h=1c157f4f70594af6b369b426422dfb69dcdafbf3;hp=fccf3b0dd73f14c2e46dc76d426fbfe1bae7eab8;hb=2715f6522ca62ab5dbc886c21ed18945743216f0;hpb=021f5586a328c6600460aa9f9be664ba19ba20d4 diff --git a/src/snprintf.c b/src/snprintf.c index fccf3b0..1c157f4 100644 --- a/src/snprintf.c +++ b/src/snprintf.c @@ -1,13 +1,14 @@ -/* - * Copyright (C) 2007, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2011 Index Data * See the file LICENSE for details. - * - * $Id: snprintf.c,v 1.1 2007-02-23 10:15:01 adam Exp $ */ /** * \file snprintf.c * \brief snprintf wrapper */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -15,11 +16,12 @@ void yaz_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap) { -#if HAVE_VSNPRINF +#if HAVE_VSNPRINTF 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 @@ -37,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