OSDN Git Service

Fixed buffer overflow spotted by Henrik
authorAbramo Bagnara <abramo@alsa-project.org>
Mon, 28 Aug 2000 06:33:08 +0000 (06:33 +0000)
committerAbramo Bagnara <abramo@alsa-project.org>
Mon, 28 Aug 2000 06:33:08 +0000 (06:33 +0000)
amixer/amixer.c

index 646f0a9..e938cde 100644 (file)
@@ -178,8 +178,8 @@ static snd_mixer_sid_t __simple_id ATTRIBUTE_UNUSED;
 
 static char *simple_name(const char *name, char *result)
 {
-       strncpy(result, name, simple_name_size);
-       result[simple_name_size] = '\0';
+       strncpy(result, name, simple_name_size - 1);
+       result[simple_name_size - 1] = '\0';
        return result;
 }