From a470be169558c63bccfb87761d482d90421d979a Mon Sep 17 00:00:00 2001 From: degomme Date: Tue, 2 Apr 2019 10:37:49 +0200 Subject: [PATCH] avoid potential segfault when fed nonsense --- src/smpi/bindings/smpi_pmpi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index 43cbdb8c3a..6b831d51df 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -215,7 +215,7 @@ int PMPI_Error_class(int errorcode, int* errorclass) { } int PMPI_Error_string(int errorcode, char* string, int* resultlen){ - if (errorcode<0 || string ==nullptr){ + if (errorcode<0 || errorcode>= MPI_MAX_ERROR_STRING || string ==nullptr){ return MPI_ERR_ARG; } else { static const char *smpi_error_string[] = { -- 2.20.1