All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rodolfo García Peñas" <kix@kix.es>
To: linux-pm@vger.kernel.org
Cc: rjw@sisk.pl
Subject: [PATCH] suspend-utils: checksum buffer length error
Date: Wed, 14 Aug 2013 19:42:58 +0200	[thread overview]
Message-ID: <20130814174258.GA3178@kix.es> (raw)


From bd16d8764e7606182f2871dd99b76b10df7ca9be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <kix@kix.es>
Date: Wed, 14 Aug 2013 19:25:45 +0200
Subject: [PATCH] suspend-utils: checksum buffer length error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The length for the checksum buffer csum_buf is 48. The function print_checksum
uses these 48 bytes to store the checksum. There are no space for '\0'. So, the
'\0' is written on orig_checksum[0] and then the checksum doesn't match.

This patch was sent to "http://sourceforge.net/projects/suspend/" by yecril71pl:

- - - 8< - - -
File load.c Is: static char csum_buf[48]; Let: static char csum_buf[49];
Because: 49 = (2 + 1) * 16 + 1 (for the terminating \0)
Otherwise: orig_checksum [0] = 0 and the checksums do not match.
- - - 8< - - -

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
---
 load.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/load.c b/load.c
index 6d1c6ed..0f7a26f 100644
--- a/load.c
+++ b/load.c
@@ -573,7 +573,7 @@ int read_or_verify(int dev, int fd, struct image_header_info *header,
 {
 	static struct swap_reader handle;
 	static unsigned char orig_checksum[16], checksum[16];
-	static char csum_buf[48];
+	static char csum_buf[49];
 	int error = 0, test_mode = (verify || test);
 
 	error = read_page(fd, header, start);
-- 
1.7.10.4


                 reply	other threads:[~2013-08-14 17:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20130814174258.GA3178@kix.es \
    --to=kix@kix.es \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /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.