From e1f906ec1dec531b218dd3e51aadb469973d7bd8 Mon Sep 17 00:00:00 2001 From: Caleb Date: Thu, 15 Feb 2024 16:34:43 -0500 Subject: [PATCH] WIP addressing #162, #150 --- src/outfile/swmm_output.c | 8 ++++++-- src/solver/swmm5.c | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/outfile/swmm_output.c b/src/outfile/swmm_output.c index fad4c236e..41473ab29 100644 --- a/src/outfile/swmm_output.c +++ b/src/outfile/swmm_output.c @@ -177,7 +177,7 @@ int EXPORT_OUT_API SMO_open(SMO_Handle p_handle, const char *path) else { #ifdef _MSC_VER - strncpy_s(p_data->name, path, MAXFILENAME); + strncpy_s(p_data->name, MAXFILENAME, path, MAXFILENAME); #else strncpy(p_data->name, path, MAXFILENAME); #endif @@ -532,8 +532,12 @@ int EXPORT_OUT_API SMO_getElementName(SMO_Handle p_handle, SMO_elementType type, *name = newCharArray(*length + 1); // Writes IDname and an additional null character to name + #ifdef _MSC_VER - strncpy_s(*name, p_data->elementNames[idx].IDname, + strncpy_s( + *name, + (*length + 1) * sizeof(char), + p_data->elementNames[idx].IDname, (*length + 1) * sizeof(char)); #else strncpy(*name, p_data->elementNames[idx].IDname, diff --git a/src/solver/swmm5.c b/src/solver/swmm5.c index a6082adfd..b34c0f583 100644 --- a/src/solver/swmm5.c +++ b/src/solver/swmm5.c @@ -948,7 +948,8 @@ double DLLEXPORT swmm_getValue(int property, int index) return getNodeValue(property, index); if (property < 500) return getLinkValue(property, index); - return ERR_API_NO_DATA; + + return ERR_API_PROPERTY_TYPE; } //=============================================================================