8300038: Make new version of JNU_GetStringPlatformChars which checks for null characters

Reviewed-by: dfuchs, naoto
This commit is contained in:
Michael McMahon 2023-05-25 14:57:29 +00:00
parent 90e57fd5a9
commit e7edf8d145
9 changed files with 187 additions and 25 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -100,7 +100,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
JNU_ThrowNullPointerException(env, "host argument is null");
return NULL;
}
hostname = JNU_GetStringPlatformChars(env, host, NULL);
hostname = JNU_GetStringPlatformCharsStrict(env, host, NULL);
CHECK_NULL_RETURN(hostname, NULL);
// try once, with our static buffer

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -219,7 +219,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
JNU_ThrowNullPointerException(env, "host argument is null");
return NULL;
}
hostname = JNU_GetStringPlatformChars(env, host, NULL);
hostname = JNU_GetStringPlatformCharsStrict(env, host, NULL);
CHECK_NULL_RETURN(hostname, NULL);
// try once, with our static buffer