]> git.sesse.net Git - vlc/commitdiff
snprintf() always puts a nul terminator...
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 11 Apr 2010 08:19:42 +0000 (11:19 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 11 Apr 2010 08:19:42 +0000 (11:19 +0300)
...unless the buffer has zero size.
This is not to be confused with strncpy().

src/libvlc.c

index b5c87332e7b2a606563a28e28615942c1761b628..b11f40fc1ef69ddb86bcd93c275bc0f8468864d6 100644 (file)
@@ -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