summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroeber%netscape.com <devnull@localhost>2000-04-19 21:24:57 +0000
committerroeber%netscape.com <devnull@localhost>2000-04-19 21:24:57 +0000
commit0e18e06b9b566005f305352770d1dfadb2a3bf57 (patch)
treecc549b8c522abed227a3ce29c93987a3ea6ecb7c
parentc0a6f6cea5a2d96e65797314834a1464a260b3d1 (diff)
downloadnss-hg-0e18e06b9b566005f305352770d1dfadb2a3bf57.tar.gz
I missed a couple usages of nssUTF8_Size when its signature changed.
Also made a pedantic check #ifdef PEDANTIC.
-rw-r--r--security/nss/lib/base/utf8.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/security/nss/lib/base/utf8.c b/security/nss/lib/base/utf8.c
index 5f65804fc..d2848066b 100644
--- a/security/nss/lib/base/utf8.c
+++ b/security/nss/lib/base/utf8.c
@@ -311,7 +311,8 @@ nssUTF8_Size
#endif /* NSSDEBUG */
sv = PL_strlen((const char *)s) + 1;
- if( '\0' != ((const char *)s)[ sv ] ) {
+#ifdef PEDANTIC
+ if( '\0' != ((const char *)s)[ sv-1 ] ) {
/* wrapped */
nss_SetError(NSS_ERROR_VALUE_TOO_LARGE);
if( (PRStatus *)NULL != statusOpt ) {
@@ -319,6 +320,7 @@ nssUTF8_Size
}
return 0;
}
+#endif /* PEDANTIC */
if( (PRStatus *)NULL != statusOpt ) {
*statusOpt = PR_SUCCESS;
@@ -567,6 +569,8 @@ nssUTF8_GetEncoding
)
{
NSSItem *rv = (NSSItem *)NULL;
+ PRStatus status = PR_SUCCESS;
+
#ifdef NSSDEBUG
if( (NSSArena *)NULL != arenaOpt ) {
if( PR_SUCCESS != nssArena_verifyPointer(arenaOpt) ) {
@@ -615,11 +619,11 @@ nssUTF8_GetEncoding
rv->data = dup;
dup = (NSSUTF8 *)NULL;
- if( PR_SUCCESS != nssUTF8_Size(dup, &rv->size) ) {
+ rv->size = nssUTF8_Size(rv->data, &status);
+ if( (0 == rv->size) && (PR_SUCCESS != status) ) {
if( (NSSItem *)NULL == rvOpt ) {
(void)nss_ZFreeIf(rv);
}
- (void)nss_ZFreeIf(dup);
return (NSSItem *)NULL;
}
}
@@ -678,7 +682,7 @@ nssUTF8_CopyIntoFixedBuffer
string = "";
}
- (void)nssUTF8_Size(string, &stringSize);
+ stringSize = nssUTF8_Size(string, (PRStatus *)NULL);
stringSize--; /* don't count the trailing null */
if( stringSize > bufferSize ) {
PRUint32 bs = bufferSize;