f64f934fab
from Alexander Shiryaev (MAINTAINER)
54 lines
2.5 KiB
Plaintext
54 lines
2.5 KiB
Plaintext
$OpenBSD: patch-lpc21isp_c,v 1.2 2011/10/19 11:38:47 jasper Exp $
|
|
--- lpc21isp.c.orig Tue Aug 2 16:55:18 2011
|
|
+++ lpc21isp.c Wed Oct 19 13:22:52 2011
|
|
@@ -1,3 +1,4 @@
|
|
+#include <assert.h>
|
|
/******************************************************************************
|
|
|
|
Project: Portable command line ISP for NXP LPC1000 / LPC2000 family
|
|
@@ -696,7 +697,7 @@ static void ReceiveComPortBlock(ISP_ENVIRONMENT *IspEn
|
|
|
|
#endif // defined COMPILE_FOR_LINUX
|
|
|
|
- sprintf(tmp_string, "Read(Length=%ld): ", (*real_size));
|
|
+ int rCheckSNPrintF1 = snprintf(tmp_string, sizeof(tmp_string), "Read(Length=%ld): ", (*real_size)); assert( rCheckSNPrintF1 < sizeof(tmp_string) );
|
|
DumpString(5, answer, (*real_size), tmp_string);
|
|
|
|
if (*real_size == 0)
|
|
@@ -999,7 +1000,7 @@ void DebugPrintf(int level, const char *fmt, ...)
|
|
char pTemp[2000];
|
|
va_start(ap, fmt);
|
|
//vprintf(fmt, ap);
|
|
- vsprintf(pTemp, fmt, ap);
|
|
+ int rCheckSNPrintF0 = vsnprintf(pTemp, sizeof(pTemp), fmt, ap); assert( rCheckSNPrintF0 < sizeof(pTemp) );
|
|
TRACE(pTemp);
|
|
va_end(ap);
|
|
fflush(stdout);
|
|
@@ -1071,7 +1072,7 @@ void ReceiveComPort(ISP_ENVIRONMENT *IspEnvironment,
|
|
|
|
Answer[(*RealSize)] = 0;
|
|
|
|
- sprintf(tmp_string, "Answer(Length=%ld): ", (*RealSize));
|
|
+ int rCheckSNPrintF2 = snprintf(tmp_string, sizeof(tmp_string), "Answer(Length=%ld): ", (*RealSize)); assert( rCheckSNPrintF2 < sizeof(tmp_string) );
|
|
DumpString(3, Answer, (*RealSize), tmp_string);
|
|
}
|
|
|
|
@@ -1106,7 +1107,7 @@ int ReceiveComPortBlockComplete(ISP_ENVIRONMENT *IspEn
|
|
|
|
} while ((realsize < size) && (SerialTimeoutCheck(IspEnvironment) == 0));
|
|
|
|
- sprintf(tmp_string, "Answer(Length=%ld): ", realsize);
|
|
+ int rCheckSNPrintF3 = snprintf(tmp_string, sizeof(tmp_string), "Answer(Length=%ld): ", realsize); assert( rCheckSNPrintF3 < sizeof(tmp_string) );
|
|
DumpString(3, result, realsize, tmp_string);
|
|
|
|
if (realsize != size)
|
|
@@ -2183,7 +2184,7 @@ int lpctest(char* FileName)
|
|
IspEnvironment.baud_rate = "19200";
|
|
IspEnvironment.nQuestionMarks = 100;
|
|
IspEnvironment.DoNotStart = 0;
|
|
- strcpy(IspEnvironment.StringOscillator, "25000");
|
|
+ int rCheckSNPrintF4 = snprintf(IspEnvironment.StringOscillator, sizeof(IspEnvironment.StringOscillator), "%s", "25000"); assert( rCheckSNPrintF4 < sizeof(IspEnvironment.StringOscillator) );
|
|
|
|
return PerformActions(&IspEnvironment); // Do as requested !
|
|
}
|