mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r2610: Even if we only use the fast-path (ascii only) then
we still need to set errno = E2BIG when we overflow. Jeremy.
This commit is contained in:
parent
ca9516520f
commit
7b0560dccc
@ -394,6 +394,13 @@ size_t convert_string(charset_t from, charset_t to,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (!dlen) {
|
||||
/* Even if we fast path we should note if we ran out of room. */
|
||||
if (((slen != (size_t)-1) && slen) ||
|
||||
((slen == (size_t)-1) && lastp)) {
|
||||
errno = E2BIG;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
} else if (from == CH_UCS2 && to != CH_UCS2) {
|
||||
const unsigned char *p = (const unsigned char *)src;
|
||||
@ -423,6 +430,13 @@ size_t convert_string(charset_t from, charset_t to,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (!dlen) {
|
||||
/* Even if we fast path we should note if we ran out of room. */
|
||||
if (((slen != (size_t)-1) && slen) ||
|
||||
((slen == (size_t)-1) && lastp)) {
|
||||
errno = E2BIG;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
} else if (from != CH_UCS2 && to == CH_UCS2) {
|
||||
const unsigned char *p = (const unsigned char *)src;
|
||||
@ -452,6 +466,13 @@ size_t convert_string(charset_t from, charset_t to,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (!dlen) {
|
||||
/* Even if we fast path we should note if we ran out of room. */
|
||||
if (((slen != (size_t)-1) && slen) ||
|
||||
((slen == (size_t)-1) && lastp)) {
|
||||
errno = E2BIG;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user