Skip to content

AlsaMixer.app: buffer overflow detected #65

@andreymal

Description

@andreymal

Crashes immediately:

$ AlsaMixer.app
*** buffer overflow detected ***: terminated                                                                                               

Program received signal SIGABRT, Aborted.

It seems this line forgot to allocate memory for the null character:

--- a/AlsaMixer.app/AMixer/AMixer.cc
+++ b/AlsaMixer.app/AMixer/AMixer.cc
@@ -23,7 +23,7 @@ AMixer::AMixer(const char *card) {
   int err;
 
   if (card) {
-    cardName = new char[std::strlen(card)];
+    cardName = new char[std::strlen(card) + 1];
     std::strcpy(cardName, card);
     for (int i = 0; i < MIXER_ITEMS; i++)
       mixerItems[i] = NULL;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions