From a54335c703c1abb1ea72a109bd99a6919f57ce70 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sun, 11 Apr 2010 11:19:42 +0300 Subject: [PATCH 1/1] snprintf() always puts a nul terminator... ...unless the buffer has zero size. This is not to be confused with strncpy(). --- src/libvlc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 -- 2.39.2