diff --git a/apps/decoder.c b/apps/decoder.c index be38d4e859da32cb390f9e92ef983885bad6a9aa..a5927d06e4adbe65cf9735f1e2a1420d00ba2a9a 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" );