1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3: utils: Don't directly manipulate errno inside strupper_m().

Let the internal character conversion routines set it.

Caller code paths don't depend on this (checked by
David Disseldorp ddiss@suse.de).

Bug 10775 - smbd crashes when accessing garbage filenames

https://bugzilla.samba.org/show_bug.cgi?id=10775

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
This commit is contained in:
Jeremy Allison 2014-09-12 08:46:06 -07:00 committed by David Disseldorp
parent c56a88da6e
commit 6bce3d81e1

View File

@ -551,7 +551,6 @@ _PUBLIC_ void strupper_m(char *s)
bool strupper_m(char *s)
{
size_t len;
int errno_save;
bool ret = false;
/* this is quite a common operation, so we want it to be
@ -570,14 +569,11 @@ bool strupper_m(char *s)
/* I assume that lowercased string takes the same number of bytes
* as source string even in multibyte encoding. (VIV) */
len = strlen(s) + 1;
errno_save = errno;
errno = 0;
ret = unix_strupper(s,len,s,len);
/* Catch mb conversion errors that may not terminate. */
if (errno) {
if (!ret) {
s[len-1] = '\0';
}
errno = errno_save;
return ret;
}