From 2e5f3bd50b5c940b757bfbb5b0af2ba150dadeef Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Tue, 3 Feb 2026 10:19:39 +0100 Subject: [PATCH] replace sizeof() with strlen() --- apps/decoder.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index be38d4e85..a5927d06e 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1713,9 +1713,13 @@ static ivas_error initOnFirstGoodFrame( if ( arg.rtpOutSR && srRtp != NULL ) { FILE *fParamsSR = NULL; - char srParamsFile[FILENAME_MAX], *ext = ".sr.txt"; - strncpy( srParamsFile, arg.outputWavFilename, FILENAME_MAX - sizeof( ext ) ); - strncat( srParamsFile, ext, sizeof( ext ) + 1 ); + char srParamsFile[FILENAME_MAX]; + const char *ext = ".sr.txt"; + + strncpy( srParamsFile, arg.outputWavFilename, FILENAME_MAX - strlen( ext ) - 1 ); + srParamsFile[FILENAME_MAX - strlen( ext ) - 1] = '\0'; + strncat( srParamsFile, ext, strlen( ext ) ); + srParamsFile[FILENAME_MAX - 1] = '\0'; /* Write the Split Rendering Params passed from SDP to srParamsFile */ fParamsSR = fopen( srParamsFile, "w" ); -- GitLab