--- b/sys/netsmb/smb_smb.c +++ b/sys/netsmb/smb_smb.c @@ -771,7 +771,12 @@ u_int8_t wc; int error, rlen, blksz; - if (SSTOVC(ssp)->vc_sopt.sv_caps & SMB_CAP_LARGE_READX) + if (uio->uio_offset > UINT32_MAX + && !(SSTOVC(ssp)->vc_sopt.sv_caps & SMB_CAP_LARGE_FILES)) { + return (EFBIG); + } + + if (SSTOVC(ssp)->vc_sopt.sv_caps & (SMB_CAP_LARGE_READX | SMB_CAP_LARGE_FILES)) return (smb_smb_readx(ssp, fid, len, rresid, uio, scred)); error = smb_rq_alloc(SSTOCP(ssp), SMB_COM_READ, scred, &rqp); @@ -850,7 +855,12 @@ u_int8_t wc; int error, blksz; - if (*len && SSTOVC(ssp)->vc_sopt.sv_caps & SMB_CAP_LARGE_WRITEX) + if (uio->uio_offset > UINT32_MAX + && !(SSTOVC(ssp)->vc_sopt.sv_caps & SMB_CAP_LARGE_FILES)) { + return (EFBIG); + } + + if (*len && SSTOVC(ssp)->vc_sopt.sv_caps & (SMB_CAP_LARGE_WRITEX | SMB_CAP_LARGE_FILES)) return (smb_smb_writex(ssp, fid, len, rresid, uio, scred)); blksz = SSTOVC(ssp)->vc_txmax - SMB_HDRLEN - 16;