* [PATCH] queue-export: fix crash
@ 2009-05-28 16:59 Alan Jenkins
2009-05-28 17:27 ` Kay Sievers
0 siblings, 1 reply; 2+ messages in thread
From: Alan Jenkins @ 2009-05-28 16:59 UTC (permalink / raw)
To: linux-hotplug
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-28 17:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 16:59 [PATCH] queue-export: fix crash Alan Jenkins
2009-05-28 17:27 ` Kay Sievers
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 NNTP newsgroup(s).