diff options
| author | Ritwik Ghoshal <Ritwik.Ghoshal@Sun.COM> | 2009-06-16 06:00:14 -0700 |
|---|---|---|
| committer | Ritwik Ghoshal <Ritwik.Ghoshal@Sun.COM> | 2009-06-16 06:00:14 -0700 |
| commit | e44e85a7f9935f0428e188393e3da61b17e83884 (patch) | |
| tree | 4f4be1c70b3f8786d336af0d630169fb1fc6f2a1 | |
| parent | 6e1fa242609208de48dfe1939b8814d4dff455a5 (diff) | |
| download | illumos-gate-e44e85a7f9935f0428e188393e3da61b17e83884.tar.gz | |
6836899 sasl_encode() is vulnerable to buffer overflow (VU#238019)
| -rw-r--r-- | usr/src/lib/libsasl/lib/saslutil.c | 10 |
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; } |
