Merge these two tests
authorWouter Verhelst <w@uter.be>
Wed, 6 Mar 2013 11:53:24 +0000 (12:53 +0100)
committerWouter Verhelst <w@uter.be>
Wed, 6 Mar 2013 12:09:57 +0000 (13:09 +0100)
Testing for "larger than the max value" is impossible and silly, but is
what the next test actually tests. Remove the erroneous one.

nbd-server.c

index 599cc69..d49874d 100644 (file)
@@ -1764,14 +1764,8 @@ int mainloop(CLIENT *client) {
                memcpy(reply.handle, request.handle, sizeof(reply.handle));
 
                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 (request.from + len < request.from) { // 64 bit overflow!!
-                               DEBUG("[RANGE!]");
+                               DEBUG("[Number too large!]");
                                ERROR(client, reply, EINVAL);
                                continue;
                        }