summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/src/fpdfview.cpp9
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp7
2 files changed, 11 insertions, 5 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index db191245f3..c0b39ed3b8 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -572,7 +572,8 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int
#ifdef DEBUG_TRACE
{
char str[128];
- sprintf(str, "Rendering DIB %d x %d", width, height);
+ memset(str, 0, sizeof(str));
+ FXSYS_snprintf(str, sizeof(str) - 1, "Rendering DIB %d x %d", width, height);
CPDF_ModuleMgr::Get()->ReportError(999, str);
}
#endif
@@ -590,7 +591,8 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int
if (pContext->m_hBitmap == NULL) {
#if defined(DEBUG) || defined(_DEBUG)
char str[128];
- sprintf(str, "Error CreateDIBSection: %d x %d, error code = %d", width, height, GetLastError());
+ memset(str, 0, sizeof(str));
+ FXSYS_snprintf(str, sizeof(str) - 1, "Error CreateDIBSection: %d x %d, error code = %d", width, height, GetLastError());
CPDF_ModuleMgr::Get()->ReportError(FPDFERR_OUT_OF_MEMORY, str);
#else
CPDF_ModuleMgr::Get()->ReportError(FPDFERR_OUT_OF_MEMORY, NULL);
@@ -626,7 +628,8 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int
if (hMemDC == NULL) {
#if defined(DEBUG) || defined(_DEBUG)
char str[128];
- sprintf(str, "Error CreateCompatibleDC. Error code = %d", GetLastError());
+ memset(str, 0, sizeof(str));
+ FXSYS_snprintf(str, sizeof(str) - 1, "Error CreateCompatibleDC. Error code = %d", GetLastError());
CPDF_ModuleMgr::Get()->ReportError(FPDFERR_OUT_OF_MEMORY, str);
#else
CPDF_ModuleMgr::Get()->ReportError(FPDFERR_OUT_OF_MEMORY, NULL);
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index e57eb674cc..e80d3b8e73 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -358,13 +358,16 @@ CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString()
{
CFX_ByteString dtStr;
char tempStr[32];
- sprintf(tempStr, "D:%04d%02d%02d%02d%02d%02d", dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second);
+ memset(tempStr, 0, sizeof(tempStr));
+ FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02d%02d%02d%02d%02d",
+ dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second);
dtStr = CFX_ByteString(tempStr);
if (dt.tzHour < 0)
dtStr += CFX_ByteString("-");
else
dtStr += CFX_ByteString("+");
- sprintf(tempStr, "%02d'%02d'", abs(dt.tzHour), dt.tzMinute);
+ memset(tempStr, 0, sizeof(tempStr));
+ FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02d'", abs(dt.tzHour), dt.tzMinute);
dtStr += CFX_ByteString(tempStr);
return dtStr;
}