Don't forget to convert to network byte order
authorWouter Verhelst <w@uter.be>
Sat, 5 May 2012 09:22:11 +0000 (11:22 +0200)
committerWouter Verhelst <w@uter.be>
Sat, 5 May 2012 09:22:11 +0000 (11:22 +0200)
nbd-server.c

index bd8250a3c57f4a9be4ee3b87d16833e4e1959002..f2e611f35e54d4830ab8a4f06154253548a467a3 100644 (file)
@@ -1571,10 +1571,10 @@ static void handle_list(uint32_t opt, int net, GArray* servers, uint32_t cflags)
        }
        for(i=0; i<servers->len; i++) {
                SERVER* serve = &(g_array_index(servers, SERVER, i));
-               len = strlen(serve->servename);
+               len = htonl(strlen(serve->servename));
                memcpy(buf, &len, sizeof(len));
                strcpy(ptr, serve->servename);
-               send_reply(opt, net, NBD_REP_SERVER, len+sizeof(len), buf);
+               send_reply(opt, net, NBD_REP_SERVER, strlen(serve->servename)+sizeof(len), buf);
        }
        send_reply(opt, net, NBD_REP_ACK, 0, NULL);
 }