[Libreoffice-commits] online.git: kit/DummyLibreOfficeKit.cpp
Miklos Vajna
vmiklos at collabora.co.uk
Mon Feb 13 08:56:46 UTC 2017
kit/DummyLibreOfficeKit.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
New commits:
commit 5c464d36b6c6427c4828a793ef12cdf5584ce347
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Feb 13 09:56:21 2017 +0100
kit: strcpy -> strncpy in DummyLibreOfficeKit
Change-Id: I2e142efb6138a7712d9ba3953de9faa9fc0ab03c
diff --git a/kit/DummyLibreOfficeKit.cpp b/kit/DummyLibreOfficeKit.cpp
index 91bb4fa..93c7f49 100644
--- a/kit/DummyLibreOfficeKit.cpp
+++ b/kit/DummyLibreOfficeKit.cpp
@@ -276,7 +276,7 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
(void) nPart;
char* pMemory = static_cast<char*>(malloc(11));
- strcpy(pMemory, "Dummy part");
+ strncpy(pMemory, "Dummy part", 10);
return pMemory;
}
@@ -399,12 +399,12 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMi
(void) pUsedMimeType;
char* pMemory = static_cast<char*>(malloc(11));
- strcpy(pMemory, "Dummy text");
+ strncpy(pMemory, "Dummy text", 10);
if (pUsedMimeType)
{
*pUsedMimeType = static_cast<char*>(malloc(25));
- strcpy(*pUsedMimeType, "text/plain;charset=utf-8");
+ strncpy(*pUsedMimeType, "text/plain;charset=utf-8", 24);
}
return pMemory;
@@ -439,7 +439,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
(void) pCommand;
char* pMemory = static_cast<char*>(malloc(1));
- strcpy(pMemory, "");
+ strncpy(pMemory, "", 0);
return pMemory;
}
@@ -515,7 +515,7 @@ static char* lo_getError (LibreOfficeKit *pThis)
(void) pThis;
char* pMemory = static_cast<char*>(malloc(12));
- strcpy(pMemory, "Dummy error");
+ strncpy(pMemory, "Dummy error", 11);
return pMemory;
}
@@ -557,7 +557,7 @@ static char* lo_getVersionInfo(LibreOfficeKit* /*pThis*/)
"}";
char* pVersion = static_cast<char*>(malloc(sizeof(version)));
- strcpy(pVersion, version);
+ strncpy(pVersion, version, sizeof(version) - 1);
return pVersion;
}
More information about the Libreoffice-commits
mailing list