From bddab16b613f3239964d816de2f690be43c80f99 Mon Sep 17 00:00:00 2001 From: Dirk Schumacher Date: Wed, 30 Nov 2022 10:14:12 +0100 Subject: [PATCH] Use vsnsprintf instead of vsprintf This fixes a security warning generated by Apple Clang 14. --- src/io/FilereaderLp.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/io/FilereaderLp.cpp b/src/io/FilereaderLp.cpp index bf3d8d2f7c..2c6eff017c 100644 --- a/src/io/FilereaderLp.cpp +++ b/src/io/FilereaderLp.cpp @@ -17,6 +17,7 @@ #include "io/FilereaderLp.h" #include +#include #include #include @@ -211,7 +212,7 @@ void FilereaderLp::writeToFile(FILE* file, const char* format, ...) { va_list argptr; va_start(argptr, format); char stringbuffer[LP_MAX_LINE_LENGTH + 1]; - HighsInt tokenlength = vsprintf(stringbuffer, format, argptr); + HighsInt tokenlength = vsnprintf(stringbuffer, sizeof stringbuffer, format, argptr); if (this->linelength + tokenlength >= LP_MAX_LINE_LENGTH) { fprintf(file, "\n"); fprintf(file, "%s", stringbuffer);