diff --git a/src/client.c b/src/client.c index bf3973e..b6de009 100644 --- a/src/client.c +++ b/src/client.c @@ -316,7 +316,7 @@ int client_request_needs_reply( struct client * client, "after an entrust message."); /* check it's not out of range */ if ( request.from+request.len > client->serve->size) { - debug("request read %llx+%ld out of range", + debug("request read %d+%d out of range", request.from, request.len ); @@ -435,7 +435,7 @@ void client_reply( struct client* client, struct nbd_request request ) /* Returns 0 if we should continue trying to serve requests */ int client_serve_request(struct client* client) { - struct nbd_request request; + struct nbd_request request = {0}; int failure = 1; int disconnected = 0; diff --git a/src/util.c b/src/util.c index f6fd4b8..cf7c4f6 100644 --- a/src/util.c +++ b/src/util.c @@ -44,6 +44,8 @@ void exit_err( const char *msg ) void mylog(int line_level, const char* format, ...) { va_list argptr; + char * format_n = NULL; + int format_len; if (line_level < log_level) { return; } @@ -52,9 +54,9 @@ void mylog(int line_level, const char* format, ...) * and avoid a second fprintf. This stops log lines from getting * interleaved. */ - int format_len = strlen( format ); - char *format_n = xmalloc( format_len + 2 ); - memcpy( format_n, format, format_len ); + format_len = strlen( format ); + format_n = xmalloc( format_len + 2 ); + memcpy( format_n, format, format_len+1 ); format_n[format_len] = '\n'; va_start(argptr, format);