]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
Add trailing NUL character to snprintf output
authorLennart Poettering <lennart@poettering.net>
Thu, 21 Aug 2008 22:11:13 +0000 (00:11 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 3 Sep 2008 18:25:36 +0000 (20:25 +0200)
snprintf doesn't necessarily append a trailing NUL to the strings it writes. So
let's do it explicitly.

pulse/pulse.c

index 8a60507ba13e9b94b6419bc9c7d3d67bb9c63218..8e47b6c912af46a71f1b227815acec15bcabccb8 100644 (file)
@@ -162,6 +162,7 @@ snd_pulse_t *pulse_new(void)
                         pa_path_get_filename(proc));
        else
                snprintf(buf, sizeof(buf), "ALSA plug-in");
+       buf[sizeof(buf)-1] = 0;
 
        p->context =
            pa_context_new(pa_threaded_mainloop_get_api(p->mainloop), buf);