Creating Java strings: don't include null char in length count
git-svn-id: svn://10.0.0.236/trunk@1151 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -209,7 +209,8 @@ native_netscape_npasw_SetupPlugin_SECURE_0005fGetNameValuePair(JRIEnv *env,
|
||||
|
||||
ret = GetPrivateProfileString(section, name, "", buf, INI_BUFFER_SIZE, file);
|
||||
|
||||
len = (short)ret + 1;
|
||||
// len = (short)ret + 1; // This appears to be incorrect, causes null char in string
|
||||
len = (short)ret;
|
||||
}
|
||||
|
||||
value = JRI_NewStringPlatform(env, buf, len, NULL, 0);
|
||||
|
||||
@@ -522,7 +522,8 @@ java_lang_String * getRegElement(JRIEnv *env,
|
||||
}
|
||||
|
||||
|
||||
long length = 1 + strlen(value); // 1 extra for the null char
|
||||
// long length = 1 + strlen(value); // 1 extra for the null char -- WRONG!
|
||||
long length = strlen(value);
|
||||
|
||||
if (extendLen == TRUE) {
|
||||
rtnValue = (char *)malloc(sizeof(char) * length);
|
||||
|
||||
Reference in New Issue
Block a user