mirror of
https://github.com/php/php-src.git
synced 2025-08-17 06:28:50 +02:00
Don't assume that Java byte arrays are null terminated.
This commit is contained in:
parent
a5a9a4928b
commit
313ca6b5e8
2 changed files with 4 additions and 2 deletions
|
@ -653,7 +653,8 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromString
|
|||
presult->type=IS_STRING;
|
||||
presult->value.str.len=(*jenv)->GetArrayLength(jenv, jvalue);
|
||||
presult->value.str.val=emalloc(presult->value.str.len+1);
|
||||
strcpy(presult->value.str.val, value);
|
||||
memcpy(presult->value.str.val, value, presult->value.str.len);
|
||||
presult->value.str.val[presult->value.str.len]=0;
|
||||
if (isCopy) (*jenv)->ReleaseByteArrayElements(jenv, jvalue, value, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue