]> git.tue.mpg.de Git - paraslash.git/commitdiff
afs.c: Avoid strcpy to a fixed size buffer.
authorAndre Noll <maan@systemlinux.org>
Fri, 26 Oct 2007 13:15:58 +0000 (15:15 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 26 Oct 2007 13:15:58 +0000 (15:15 +0200)
afs.c

diff --git a/afs.c b/afs.c
index c2ac0e4110e15ceac8f677947894e2a1afd057b4..34e53806e1470be55bf94c82098a63dbfd953fa3 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -540,7 +540,9 @@ static int activate_mood_or_playlist(char *arg, int *num_admissible)
                if (arg) {
                        current_mop = para_strdup(arg);
                        mmd_lock();
-                       strcpy(mmd->afs_mode_string, arg); /* FIXME: check length */
+                       strncpy(mmd->afs_mode_string, arg,
+                               sizeof(mmd->afs_mode_string));
+                       mmd->afs_mode_string[sizeof(mmd->afs_mode_string) - 1] = '\0';
                        mmd_unlock();
                } else {
                        mmd_lock();