From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] queue-export: fix crash
Date: Thu, 28 May 2009 16:59:06 +0000 [thread overview]
Message-ID: <4A1EC2DA.8030307@tuffmail.co.uk> (raw)
The math in skip_to() was the wrong way round and allocated a
variable size array on the stack with a massively negative size.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
---
udev/lib/libudev-queue-export.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/udev/lib/libudev-queue-export.c b/udev/lib/libudev-queue-export.c
index ddb1974..a36ff51 100644
--- a/udev/lib/libudev-queue-export.c
+++ b/udev/lib/libudev-queue-export.c
@@ -115,8 +115,8 @@ static int skip_to(FILE *file, long offset)
/* fseek may drop buffered data, avoid it for small seeks */
old_offset = ftell(file);
- if (offset > old_offset && old_offset - offset <= BUFSIZ) {
- size_t skip_bytes = old_offset - offset;
+ if (offset > old_offset && offset - old_offset <= BUFSIZ) {
+ size_t skip_bytes = offset - old_offset;
char buf[skip_bytes];
if (fread(buf, skip_bytes, 1, file) != skip_bytes)
--
1.5.4.3
next reply other threads:[~2009-05-28 16:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-28 16:59 Alan Jenkins [this message]
2009-05-28 17:27 ` [PATCH] queue-export: fix crash Kay Sievers
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=4A1EC2DA.8030307@tuffmail.co.uk \
--to=alan-jenkins@tuffmail.co.uk \
--cc=linux-hotplug@vger.kernel.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: 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.