From 5e0ae3d2f7e2723042c462c9851c0162df683556 Mon Sep 17 00:00:00 2001 From: Michal Cmarada Date: Fri, 24 May 2019 11:46:03 +0200 Subject: fix length for string processing In case string is null jstr_length crashes, this fixes the issue and returns 0 because null strings are replaced by empty strings later in process. Change-Id: Ib6b7a3985ae379207c4a06eb38df78dfdfbaffda Signed-off-by: Michal Cmarada --- java/jvpp-common/string_t.h | 1 + 1 file changed, 1 insertion(+) (limited to 'java') diff --git a/java/jvpp-common/string_t.h b/java/jvpp-common/string_t.h index 8a2b3cc..adfcde9 100644 --- a/java/jvpp-common/string_t.h +++ b/java/jvpp-common/string_t.h @@ -27,6 +27,7 @@ // */ static size_t jstr_length(JNIEnv *env, jstring string) { + if (string == NULL) return 0; return ((int) (*env)->GetStringUTFLength(env, string)); } -- cgit 1.2.3-korg