summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/charcnv.c5
-rw-r--r--source3/lib/username.c5
-rw-r--r--source3/lib/util_names.c3
-rw-r--r--source3/lib/util_str.c14
4 files changed, 19 insertions, 8 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 5863d72f38..32ba97aaa4 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -61,7 +61,10 @@ size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags)
if (!tmpbuf) {
smb_panic("malloc fail");
}
- strupper_m(tmpbuf);
+ if (!strupper_m(tmpbuf)) {
+ SAFE_FREE(tmpbuf);
+ return (size_t)-1;
+ }
src = tmpbuf;
}
diff --git a/source3/lib/username.c b/source3/lib/username.c
index 5192004365..7435a59ac7 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -128,7 +128,10 @@ static struct passwd *Get_Pwnam_internals(TALLOC_CTX *mem_ctx,
}
/* Try as uppercase, if username wasn't originally uppercase */
- strupper_m(user2);
+ if (!strupper_m(user2)) {
+ goto done;
+ }
+
if(strcmp(user, user2) != 0) {
DEBUG(5,("Trying _Get_Pwnam(), username as uppercase is %s\n",
user2));
diff --git a/source3/lib/util_names.c b/source3/lib/util_names.c
index 0e128eab1c..cf54a0eece 100644
--- a/source3/lib/util_names.c
+++ b/source3/lib/util_names.c
@@ -63,8 +63,7 @@ static bool set_my_netbios_names(const char *name, int i)
smb_my_netbios_names[i] = SMB_STRDUP(name);
if (!smb_my_netbios_names[i])
return False;
- strupper_m(smb_my_netbios_names[i]);
- return True;
+ return strupper_m(smb_my_netbios_names[i]);
}
/***********************************************************************
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index f97cd3cc25..b740de6659 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -58,7 +58,7 @@ bool strnequal(const char *s1,const char *s2,size_t n)
void strnorm(char *s, int case_default)
{
if (case_default == CASE_UPPER)
- strupper_m(s);
+ (void)strupper_m(s); /* FIXME - return a bool here. */
else
strlower_m(s);
}
@@ -575,7 +575,6 @@ bool strupper_m(char *s)
/* Catch mb conversion errors that may not terminate. */
if (errno) {
s[len-1] = '\0';
- ret = false;
}
errno = errno_save;
return ret;
@@ -989,7 +988,11 @@ int asprintf_strupper_m(char **strp, const char *fmt, ...)
if (ret == -1)
return -1;
- strupper_m(result);
+ if (!strupper_m(result)) {
+ SAFE_FREE(result);
+ return -1;
+ }
+
*strp = result;
return ret;
}
@@ -1006,7 +1009,10 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...)
if (ret == NULL) {
return NULL;
}
- strupper_m(ret);
+ if (!strupper_m(ret)) {
+ TALLOC_FREE(ret);
+ return NULL;
+ }
return ret;
}