fail if we try to write beyond the fstring boundry
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15467
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
p = strchr(domuser, *lp_winbind_separator());
if (p != NULL) {
+ if (PTR_DIFF(p, domuser) >= sizeof(fstring)) {
+ DBG_ERR("index %td exceeds len of dest string %zu\n",
+ PTR_DIFF(p, domuser),
+ (sizeof(fstring) - 1));
+ return false;
+ }
fstrcpy(user, p + 1);
fstrcpy(domain, domuser);
domain[PTR_DIFF(p, domuser)] = '\0';