Skip to content

Commit

Permalink
Merge pull request #1020 from dirkschumacher/fixwarning
Browse files Browse the repository at this point in the history
Use vsnsprintf instead of vsprintf
  • Loading branch information
jajhall authored Dec 1, 2022
2 parents d85660e + bddab16 commit 0329e0c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/io/FilereaderLp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "io/FilereaderLp.h"

#include <cstdarg>
#include <cstdio>
#include <exception>
#include <map>

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0329e0c

Please sign in to comment.