summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-11-08 18:24:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-11-08 18:24:25 +0300
commit2ee2e56ee0795ed0bea5d0e9bd261010bfaa0d16 (patch)
tree696d9a32dabea34e4264bc9deba23eed187146ba /src
parent57125f88567ba481594204c08d3eff983c3017c8 (diff)
safer implementation of PathToRelative
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/path.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mir_core/src/path.cpp b/src/mir_core/src/path.cpp
index eb1577748e..dd5e49325f 100644
--- a/src/mir_core/src/path.cpp
+++ b/src/mir_core/src/path.cpp
@@ -39,8 +39,10 @@ MIR_CORE_DLL(int) PathIsAbsolute(const char *path)
MIR_CORE_DLL(int) PathToRelative(const char *pSrc, char *pOut, const char *pBase)
{
- if (!pSrc || !pSrc[0] || strlen(pSrc) > MAX_PATH)
+ if (!pSrc || !pSrc[0] || strlen(pSrc) > MAX_PATH) {
+ *pOut = 0;
return 0;
+ }
if (!PathIsAbsolute(pSrc))
strncpy_s(pOut, MAX_PATH, pSrc, _TRUNCATE);