public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: mornfall@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/daemons/common daemon-shared.c Date: Mon, 16 Jan 2012 05:09:00 -0000 [thread overview] Message-ID: <20120116050917.21695.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2012-01-16 05:09:16 Modified files: daemons/common : daemon-shared.c Log message: Fix a boundary condition in read_buffer in daemon-shared.c. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/common/daemon-shared.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8 --- LVM2/daemons/common/daemon-shared.c 2012/01/15 11:17:16 1.7 +++ LVM2/daemons/common/daemon-shared.c 2012/01/16 05:09:16 1.8 @@ -30,20 +30,19 @@ if (result < 0 && errno != EAGAIN && errno != EWOULDBLOCK) goto fail; + if ((!strncmp((*buffer) + bytes - 4, "\n##\n", 4))) { + *(*buffer + bytes - 4) = 0; + break; /* success, we have the full message now */ + } + if (bytes == buffersize) { buffersize += 1024; if (!(new = realloc(*buffer, buffersize + 1))) goto fail; *buffer = new; - } else { - (*buffer)[bytes] = 0; - if ((end = strstr((*buffer) + bytes - 4, "\n##\n"))) { - *end = 0; - break; /* success, we have the full message now */ - } - /* TODO call select here if we encountered EAGAIN/EWOULDBLOCK */ } + /* TODO call select here if we encountered EAGAIN/EWOULDBLOCK */ } return 1; fail:
next reply other threads:[~2012-01-16 5:09 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-01-16 5:09 mornfall [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-01-19 15:59 zkabelac 2011-07-18 14:42 mornfall
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20120116050917.21695.qmail@sourceware.org \ --to=mornfall@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).