Skip to content

Commit 0329e0c

Browse files
authored
Merge pull request #1020 from dirkschumacher/fixwarning
Use vsnsprintf instead of vsprintf
2 parents d85660e + bddab16 commit 0329e0c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/io/FilereaderLp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "io/FilereaderLp.h"
1818

1919
#include <cstdarg>
20+
#include <cstdio>
2021
#include <exception>
2122
#include <map>
2223

@@ -211,7 +212,7 @@ void FilereaderLp::writeToFile(FILE* file, const char* format, ...) {
211212
va_list argptr;
212213
va_start(argptr, format);
213214
char stringbuffer[LP_MAX_LINE_LENGTH + 1];
214-
HighsInt tokenlength = vsprintf(stringbuffer, format, argptr);
215+
HighsInt tokenlength = vsnprintf(stringbuffer, sizeof stringbuffer, format, argptr);
215216
if (this->linelength + tokenlength >= LP_MAX_LINE_LENGTH) {
216217
fprintf(file, "\n");
217218
fprintf(file, "%s", stringbuffer);

0 commit comments

Comments
 (0)