1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #23055 from seanm:sprintf2

* Replaced most remaining sprintf with snprintf
* Deprecated encodeFormat and introduced new method that takes the buffer length
* Also increased buffer size at call sites to be a little bigger, in case int is 64 bit
This commit is contained in:
Sean McBride
2023-04-18 02:22:59 -04:00
committed by GitHub
parent 8512deb3cc
commit 47bea69322
32 changed files with 82 additions and 71 deletions
+3 -3
View File
@@ -1167,7 +1167,7 @@ void cvCreateTestSamples( const char* infoname,
}
else
{
filename++;
filename++; // character after last / or \
}
count = MIN( count, cvbgdata->count );
@@ -1199,8 +1199,8 @@ void cvCreateTestSamples( const char* infoname,
1, 0.0, 0.0, &data );
sprintf( filename, "%04d_%04d_%04d_%04d_%04d.jpg",
(i + 1), x, y, width, height );
snprintf( filename, sizeof(fullname) - (filename - fullname), "%04d_%04d_%04d_%04d_%04d.jpg",
(i + 1), x, y, width, height );
if( info )
{