[jnigen] Fix buffer overflow issue when converting strings from JNI to Dart (https://github.com/dart-lang/jnigen/issues/416)