X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsnprintf.c;h=b053d6182b5bbc8e7438641835c97e0e28429f29;hp=e69cf9c66ec65a3c8d0e46152ea4a006d622ca6b;hb=b06636208651777c08e2456bf3b5953fc3c0f2c2;hpb=5c167071ae977b217670e573d18c112634e8aa63 diff --git a/src/snprintf.c b/src/snprintf.c index e69cf9c..b053d61 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-2013 Index Data * See the file LICENSE for details. - * - * $Id: snprintf.c,v 1.2 2007-02-26 14:24:00 adam Exp $ */ /** * \file snprintf.c * \brief snprintf wrapper */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -19,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 @@ -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