See below, to be applied on top of the other patches. Also at http://git.alex.org.uk/ commits 065a1b241dde2ab6fe333ccf5bc057e7e327f8d4 8d4b9f4e3d10fdfa319b17f385eeaae775d0071c
-- Alex Bligh Signed-Off-By: Alex Bligh <[email protected]> diff --git a/nbd-server.c b/nbd-server.c index 602d42e..4122cef 100644 --- a/nbd-server.c +++ b/nbd-server.c @@ -1453,16 +1453,19 @@ int mainloop(CLIENT *client) { (unsigned long long)request.from / 512, len); #endif memcpy(reply.handle, request.handle, sizeof(reply.handle)); - if ((request.from + len) > (OFFT_MAX)) { - DEBUG("[Number too large!]"); - ERROR(client, reply, EINVAL); - continue; - } - if (((ssize_t)((off_t)request.from + len) > client->exportsize)) { - DEBUG("[RANGE!]"); - ERROR(client, reply, EINVAL); - continue; + if ((command==NBD_CMD_WRITE) || (command==NBD_CMD_READ)) { + if ((request.from + len) > (OFFT_MAX)) { + DEBUG("[Number too large!]"); + ERROR(client, reply, EINVAL); + continue; + } + + if (((ssize_t)((off_t)request.from + len) > client->exportsize)) { + DEBUG("[RANGE!]"); + ERROR(client, reply, EINVAL); + continue; + } } if (command==NBD_CMD_WRITE) { ------------------------------------------------------------------------------ What Every C/C++ and Fortran developer Should Know! Read this article and learn how Intel has extended the reach of its next-generation tools to help Windows* and Linux* C/C++ and Fortran developers boost performance applications - including clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Nbd-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nbd-general
