Skip to content

Commit 1f2d46b

Browse files
committed
Correct a failing unit test.
1 parent 7b331f4 commit 1f2d46b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/smtpclientbase.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ int SMTPClientBase::getErrorMessage_r(int errorCode,
304304
return -1;
305305
}
306306
if (errorMessageStr.length() > maxLength-1) {
307-
strcpy(errorMessagePtr, errorMessageStr.c_str());
307+
strncpy(errorMessagePtr, errorMessageStr.c_str(), maxLength-1);
308+
errorMessagePtr[maxLength-1] = '\0';
308309
return static_cast<int>(maxLength-1);
309310
}
310311
strcpy(errorMessagePtr, errorMessageStr.c_str());

0 commit comments

Comments
 (0)