Merge pull request #2406 from pacovn/Coverity_1465495_Out-of-bounds_read

zebra: Out-of-bounds read (Coverity 1465495)
This commit is contained in:
Rafael Zalamena 2018-06-12 11:45:11 -03:00 committed by GitHub
commit b4ba87ebb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3061,7 +3061,7 @@ void zserv_handle_commands(struct zserv *client, struct stream *msg)
return;
}
if (hdr.command > array_size(zserv_handlers)
if (hdr.command >= array_size(zserv_handlers)
|| zserv_handlers[hdr.command] == NULL)
zlog_info("Zebra received unknown command %d", hdr.command);
else