grrrr / xsample

xsample – Extended sample objects for Pure Data and Max
http://grrrr.org/research/software/xsample
Other
11 stars 4 forks source link

Fix possible buffer overrun on Audio signal channel string #5

Closed bdrung closed 10 months ago

bdrung commented 10 months ago

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 770fd996821fd515f88d459a6a8a07ac05ce130f 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.

grrrr commented 10 months ago

Thank you, looks good!