summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRitwik Ghoshal <Ritwik.Ghoshal@Sun.COM>2009-06-16 06:00:14 -0700
committerRitwik Ghoshal <Ritwik.Ghoshal@Sun.COM>2009-06-16 06:00:14 -0700
commite44e85a7f9935f0428e188393e3da61b17e83884 (patch)
tree4f4be1c70b3f8786d336af0d630169fb1fc6f2a1
parent6e1fa242609208de48dfe1939b8814d4dff455a5 (diff)
downloadillumos-gate-e44e85a7f9935f0428e188393e3da61b17e83884.tar.gz
6836899 sasl_encode() is vulnerable to buffer overflow (VU#238019)
-rw-r--r--usr/src/lib/libsasl/lib/saslutil.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr/src/lib/libsasl/lib/saslutil.c b/usr/src/lib/libsasl/lib/saslutil.c
index ab23dbacc2..c3203efe02 100644
--- a/usr/src/lib/libsasl/lib/saslutil.c
+++ b/usr/src/lib/libsasl/lib/saslutil.c
@@ -1,8 +1,7 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/* saslutil.c
* Rob Siemborski
@@ -142,7 +141,7 @@ int sasl_encode64(const char *_in, unsigned inlen,
olen = (inlen + 2) / 3 * 4;
if (outlen)
*outlen = olen;
- if (outmax < olen)
+ if (outmax <= olen)
return SASL_BUFOVER;
/* Do the work... */
@@ -168,9 +167,8 @@ int sasl_encode64(const char *_in, unsigned inlen,
*out++ = '=';
}
- if (olen < outmax)
- *out = '\0';
-
+ *out = '\0';
+
return SASL_OK;
}