Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible buffer overrun on Audio signal channel string #5

Merged
merged 1 commit into from Oct 19, 2023

Conversation

bdrung
Copy link
Contributor

@bdrung bdrung commented Oct 19, 2023

GCC warns about a possible buffer overrun:

source/groove.cpp: In constructor ‘xgroove::xgroove(int, const t_atom*)’:
source/groove.cpp:243:56: warning: ‘%i’ directive writing between 1 and 10 bytes into a region of size 9 [-Wformat-overflow=]
  243 |                 STD::sprintf(tmp,"Audio signal channel %i",ci+1);
      |                                                        ^~
source/groove.cpp:243:34: note: directive argument in the range [1, 2147483647]
  243 |                 STD::sprintf(tmp,"Audio signal channel %i",ci+1);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~

Commit 770fd99 fixed one instance of the code in play.cpp but did not fix grove.cpp.

Increase the buffer by the needed byte and use the same value for the duplicate code.

GCC warns about a possible buffer overrun:

```
source/groove.cpp: In constructor ‘xgroove::xgroove(int, const t_atom*)’:
source/groove.cpp:243:56: warning: ‘%i’ directive writing between 1 and 10 bytes into a region of size 9 [-Wformat-overflow=]
  243 |                 STD::sprintf(tmp,"Audio signal channel %i",ci+1);
      |                                                        ^~
source/groove.cpp:243:34: note: directive argument in the range [1, 2147483647]
  243 |                 STD::sprintf(tmp,"Audio signal channel %i",ci+1);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
```

Commit 770fd99 fixed one instance of
the code in `play.cpp` but did not fix `grove.cpp`.

Increase the buffer by the needed byte and use the same value for the
duplicate code.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
@grrrr
Copy link
Owner

grrrr commented Oct 19, 2023

Thank you, looks good!

@grrrr grrrr merged commit f45c6ae into grrrr:master Oct 19, 2023
@bdrung bdrung deleted the fix-Wformat-overflow branch October 19, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants