File: sprintf.diff

package info (click to toggle)
musescore3 3.2.3%2Bdfsg2-19
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 218,192 kB
  • sloc: cpp: 291,369; xml: 200,226; sh: 3,779; ansic: 1,447; python: 393; makefile: 249; perl: 82; pascal: 79
file content (25 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Description: fix possible buffer overflow
 compiler warning, very unlikely to hit in production
 .
 Better fix would be QString::asprintf() but Qt discourages that
 for some unconceivable reason...
Author: mirabilos <m@mirbsd.org>
Forwarded: https://github.com/musescore/MuseScore/pull/5202
Applied-Upstream: v3.3

--- a/mscore/playpanel.cpp
+++ b/mscore/playpanel.cpp
@@ -353,11 +353,11 @@ void PlayPanel::updatePosLabel(int utick
       // alternative would be to use a monospaced font and a
       // single label
           
-      char barBuffer[8];
+      char barBuffer[12];
       sprintf(barBuffer, "%d", bar+1);// sprintf(barBuffer, "%03d", bar+1);
       measureLabel->setText(QString(barBuffer));
       
-      char beatBuffer[8];
+      char beatBuffer[12];
       sprintf(beatBuffer, "%02d", beat+1);
       beatLabel->setText(QString(beatBuffer));
       }