Bounds check for request id (between 0 and 255).

This commit is contained in:
Ivo Timmermans 2000-05-29 22:20:04 +00:00
parent 0f2cf48d30
commit a822c7466a

View file

@ -1,6 +1,7 @@
/* /*
net.c -- most of the network code net.c -- most of the network code
Copyright (C) 1998,1999,2000 Ivo Timmermans <zarq@iname.com> Copyright (C) 1998,1999,2000 Ivo Timmermans <itimmermans@bigfoot.com>,
2000 Guus Sliepen <guus@sliepen.warande.net>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,6 +16,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.c,v 1.31 2000/05/29 22:20:04 zarq Exp $
*/ */
#include "config.h" #include "config.h"
@ -970,7 +973,7 @@ cp
{ {
if(sscanf(cl->buffer, "%d", &request) == 1) if(sscanf(cl->buffer, "%d", &request) == 1)
{ {
if(request_handlers[request] == NULL) if((request < 0 || request > 255) || request_handlers[request] == NULL)
{ {
syslog(LOG_ERR, _("Unknown request: %s"), cl->buffer); syslog(LOG_ERR, _("Unknown request: %s"), cl->buffer);
return -1; return -1;