diff --git a/org/postgresql/util/ServerErrorMessage.java b/org/postgresql/util/ServerErrorMessage.java index e4704478b3..48aa42f553 100644 --- a/org/postgresql/util/ServerErrorMessage.java +++ b/org/postgresql/util/ServerErrorMessage.java @@ -43,7 +43,8 @@ public ServerErrorMessage(String p_serverError, int verbosity) { l_pos++; int l_startString = l_pos; - while (l_chars[l_pos] != '\0' && l_pos < l_length) + // order here is important position must be checked before accessing the array + while ( l_pos < l_length && l_chars[l_pos] != '\0' ) { l_pos++; }