From: Dan Carpenter <dan.carpenter@oracle.com>
To: Philipp Reisner <philipp.reisner@linbit.com>
Cc: drbd-user@lists.linbit.com, linux-kernel@vger.kernel.org
Subject: array underflow in receive_SyncParam()?
Date: Tue, 27 Mar 2012 10:10:36 +0300 [thread overview]
Message-ID: <20120327071036.GA19008@elgon.mountain> (raw)
I had a question about the following code:
drivers/block/drbd/drbd_receiver.c
2808 if (apv == 88) {
2809 if (data_size > SHARED_SECRET_MAX) {
2810 dev_err(DEV, "verify-alg too long, "
2811 "peer wants %u, accepting only %u byte\n",
2812 data_size, SHARED_SECRET_MAX);
2813 return false;
2814 }
2815
2816 if (drbd_recv(mdev, p->verify_alg, data_size) != data_size)
2817 return false;
2818
2819 /* we expect NUL terminated string */
2820 /* but just in case someone tries to be evil */
2821 D_ASSERT(p->verify_alg[data_size-1] == 0);
2822 p->verify_alg[data_size-1] = 0;
^^^^^^^^^
Is it possible for data_size to be zero here leading to an array
underflow? We test for overflows, but I don't see any place where we
test for zero.
regards,
dan carpenter
next reply other threads:[~2012-03-27 7:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-27 7:10 Dan Carpenter [this message]
2012-03-27 11:32 ` array underflow in receive_SyncParam()? Philipp Reisner
2012-03-27 11:43 ` Dan Carpenter
2012-03-28 8:26 ` Philipp Reisner
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=20120327071036.GA19008@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=drbd-user@lists.linbit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=philipp.reisner@linbit.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.