From: RĂ©mi Denis-Courmont Date: Sun, 11 Apr 2010 08:19:42 +0000 (+0300) Subject: snprintf() always puts a nul terminator... X-Git-Tag: 1.1.0-pre1~46 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=a54335c703c1abb1ea72a109bd99a6919f57ce70;hp=88e7248c43324b2f776cf54f4d90dc960a581756;p=vlc snprintf() always puts a nul terminator... ...unless the buffer has zero size. This is not to be confused with strncpy(). --- diff --git a/src/libvlc.c b/src/libvlc.c index b5c87332e7..b11f40fc1e 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -1177,8 +1177,7 @@ static void SetLanguage ( const char *psz_lang ) * makes the environment unconsistent when libvlc is unloaded and * should probably be moved to a safer place like vlc.c. */ static char psz_lcall[20]; - snprintf( psz_lcall, 19, "LC_ALL=%s", psz_lang ); - psz_lcall[19] = '\0'; + snprintf( psz_lcall, sizeof(psz_lcall), "LC_ALL=%s", psz_lang ); putenv( psz_lcall ); #endif