mirror of
https://github.com/samba-team/samba.git
synced 2025-03-26 18:50:30 +03:00
libcli/smb: add smb_buffer_oob() helper
A copy of trans_oob(). metze
This commit is contained in:
parent
d66d7c2b00
commit
5f520e7717
@ -23,3 +23,5 @@ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib);
|
||||
uint32_t unix_perms_to_wire(mode_t perms);
|
||||
mode_t wire_perms_to_unix(uint32_t perms);
|
||||
mode_t unix_filetype_from_wire(uint32_t wire_type);
|
||||
|
||||
bool smb_buffer_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
|
||||
|
@ -163,3 +163,15 @@ mode_t unix_filetype_from_wire(uint32_t wire_type)
|
||||
}
|
||||
}
|
||||
|
||||
bool smb_buffer_oob(uint32_t bufsize, uint32_t offset, uint32_t length)
|
||||
{
|
||||
if ((offset + length < offset) || (offset + length < length)) {
|
||||
/* wrap */
|
||||
return true;
|
||||
}
|
||||
if ((offset > bufsize) || (offset + length > bufsize)) {
|
||||
/* overflow */
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user