File: error-format

package info (click to toggle)
dds 2.9.0-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 56,576 kB
  • sloc: cpp: 17,621; ansic: 385; makefile: 27; xml: 11; sh: 7
file content (20 lines) | stat: -rw-r--r-- 743 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
Par.cpp: In function ‘int SidesPar(ddTableResults*, parResultsDealer*, int)’:
Par.cpp:1351:23: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=]
         sprintf(buff, "+%d", parm[i].contracts[k].overTricks);
                       ^~~~~
Par.cpp:1351:16: note: ‘sprintf’ output between 3 and 12 bytes into a destination of size 11
         sprintf(buff, "+%d", parm[i].contracts[k].overTricks);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--- a/src/Par.cpp
+++ b/src/Par.cpp
@@ -1275,7 +1275,7 @@ int STDCALL SidesPar(
 {
   parResultsMaster parm[2];
   int res, i, k;
-  char buff[4];
+  char buff[12];
 
   res = SidesParBin(tablep, parm, vulnerable);