mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s4:librpc: Produce more helpful error message when bytes length is odd
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
4629fc7c61
commit
d1e5a6176c
@ -447,6 +447,10 @@ uint16_t *PyUtf16String_FromBytes(TALLOC_CTX *mem_ctx, PyObject *value)
|
||||
PyErr_SetString(PyExc_ValueError, "bytes length is negative");
|
||||
return NULL;
|
||||
}
|
||||
if (len & 1) {
|
||||
PyErr_SetString(PyExc_ValueError, "bytes length is odd");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Ensure that the bytes object contains no embedded null terminator. */
|
||||
if ((size_t)len != utf16_len_n(bytes, len)) {
|
||||
|
Loading…
Reference in New Issue
Block a user