Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for 2.9.12 #38

Open
wants to merge 2 commits into
base: origin-2.9.12-1733641024
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nbd-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ gchar* rungroup=NULL;
#define OFFT_MAX ~((off_t)1<<(sizeof(off_t)*8-1))
#define LINELEN 256 /**< Size of static buffer used to read the
authorization file (yuck) */
#define BUFSIZE (1024*1024) /**< Size of buffer that can hold requests */
#define BUFSIZE ((1024*1024)+sizeof(struct nbd_reply)) /**< Size of buffer that can hold requests */
#define DIFFPAGESIZE 4096 /**< diff file uses those chunks */
#define F_READONLY 1 /**< flag to tell us a file is readonly */
#define F_MULTIFILE 2 /**< flag to tell us a file is exported using -m */
Expand Down Expand Up @@ -284,7 +284,7 @@ int authorized_client(CLIENT *opts) {
return 1;
}
}
if (strncmp(line,opts->clientname,strlen(opts->clientname))==0) {
if (strcmp(line,opts->clientname)==0) {
fclose(f);
return 1;
}
Expand Down Expand Up @@ -1139,7 +1139,7 @@ int mainloop(CLIENT *client) {

if (request.magic != htonl(NBD_REQUEST_MAGIC))
err("Not enough magic.");
if (len > BUFSIZE + sizeof(struct nbd_reply))
if (len > BUFSIZE - sizeof(struct nbd_reply))
err("Request too big!");
#ifdef DODBG
printf("%s from %llu (%llu) len %d, ", request.type ? "WRITE" :
Expand Down
Loading