mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
lib:charset: Fix error messages from charset conversion
When e.g. trying to access a filename through Samba that does not adhere to the encoding configured in 'unix charset', the log will show the encoding problem, followed by "strstr_m: src malloc fail". The problem is that strstr_m assumes that any failure from push/pull_ucs2_talloc is a memory allocation problem, which is not correct. Address this by removing the misleading messages and add a missing message in convert_string_talloc_handle. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
4ad2a716fb
commit
3430c9c3c2
@ -375,6 +375,7 @@ bool convert_string_talloc_handle(TALLOC_CTX *ctx, struct smb_iconv_handle *ic,
|
||||
}
|
||||
ob = talloc_zero_array(ctx, char, destlen);
|
||||
if (ob == NULL) {
|
||||
DBG_ERR("Could not talloc destination buffer.\n");
|
||||
errno = ENOMEM;
|
||||
return false;
|
||||
}
|
||||
|
@ -570,13 +570,11 @@ char *strstr_m(const char *src, const char *findstr)
|
||||
frame = talloc_stackframe();
|
||||
|
||||
if (!push_ucs2_talloc(frame, &src_w, src, &converted_size)) {
|
||||
DBG_WARNING("src malloc fail\n");
|
||||
TALLOC_FREE(frame);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!push_ucs2_talloc(frame, &find_w, findstr, &converted_size)) {
|
||||
DBG_WARNING("find malloc fail\n");
|
||||
TALLOC_FREE(frame);
|
||||
return NULL;
|
||||
}
|
||||
@ -591,7 +589,6 @@ char *strstr_m(const char *src, const char *findstr)
|
||||
*p = 0;
|
||||
if (!pull_ucs2_talloc(frame, &s2, src_w, &converted_size)) {
|
||||
TALLOC_FREE(frame);
|
||||
DEBUG(0,("strstr_m: dest malloc fail\n"));
|
||||
return NULL;
|
||||
}
|
||||
retp = discard_const_p(char, (s+strlen(s2)));
|
||||
|
Loading…
Reference in New Issue
Block a user