void-packages/srcpkgs/CoinMP/patches/fix-gcc9.1-strncpy.patch

20 lines
628 B
Diff
Raw Normal View History

--- CoinMP/src/CoinProblem.c 2011-11-03 04:43:29.000000000 +0100
+++ CoinMP/src/CoinProblem.c 2019-05-20 12:06:36.762510299 +0200
@@ -126,14 +126,8 @@
void coinSetProblemName(PPROBLEM pProblem, const char *ProblemName)
{
- size_t len;
-
- len = strlen(ProblemName);
- if (len >= sizeof(pProblem->ProblemName)) {
- len = sizeof(pProblem->ProblemName) - 1;
- }
- strncpy(pProblem->ProblemName, ProblemName, len);
- pProblem->ProblemName[len] = '\0';
+ snprintf(pProblem->ProblemName, sizeof(pProblem->ProblemName), "%s", ProblemName);
+ pProblem->ProblemName[sizeof(pProblem->ProblemName) - 1] = '\0';
}