avfilter/vf_libopencv: make sure there is space for null-terminator in shape_str

Fixes: warning: 'sscanf' may overflow; destination buffer in argument 7 has size 32, but the corresponding specifier may require size 33 [-Wfortify-source]
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit cca872b6fd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Kacper Michajłow
2025-12-08 03:38:56 +01:00
committed by Michael Niedermayer
parent ed0eb4031f
commit b8b30d90a5

View File

@@ -209,7 +209,7 @@ static int parse_iplconvkernel(IplConvKernel **kernel, char *buf, void *log_ctx)
int cols = 0, rows = 0, anchor_x = 0, anchor_y = 0, shape = CV_SHAPE_RECT;
int *values = NULL, ret = 0;
sscanf(buf, "%dx%d+%dx%d/%32[^=]=%127s", &cols, &rows, &anchor_x, &anchor_y, shape_str, shape_filename);
sscanf(buf, "%dx%d+%dx%d/%31[^=]=%127s", &cols, &rows, &anchor_x, &anchor_y, shape_str, shape_filename);
if (!strcmp(shape_str, "rect" )) shape = CV_SHAPE_RECT;
else if (!strcmp(shape_str, "cross" )) shape = CV_SHAPE_CROSS;