afs.c: Avoid strcpy to a fixed size buffer.
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index c2ac0e4..34e5380 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();