Be extra paranoid about the length of data returned from gethostbyaddr or

gethostbyname.
Submitted by:	Julian Assange
This commit is contained in:
Warner Losh 1997-12-24 19:38:18 +00:00
parent d3a9dd61ac
commit 45b3189258
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31977

View file

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mail.local.c,v 1.13 1997/03/28 15:48:13 imp Exp $
* $Id: mail.local.c,v 1.14 1997/11/13 23:14:34 alex Exp $
*/
#ifndef lint
@ -370,7 +370,7 @@ notifybiff(msg)
return;
}
addr.sin_family = hp->h_addrtype;
memmove(&addr.sin_addr, hp->h_addr, hp->h_length);
memmove(&addr.sin_addr, hp->h_addr, MIN(hp->h_length,sizeof(addr.sin_addr)));
addr.sin_port = sp->s_port;
}
if (f < 0 && (f = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {