From patchwork Wed Aug 14 17:42:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Rodolfo_Garc=C3=ADa_Pe=C3=B1as_=28kix=29?= X-Patchwork-Id: 2844715 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5BED5BF546 for ; Wed, 14 Aug 2013 17:53:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 884392057F for ; Wed, 14 Aug 2013 17:53:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 459102056D for ; Wed, 14 Aug 2013 17:53:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758335Ab3HNRx1 (ORCPT ); Wed, 14 Aug 2013 13:53:27 -0400 Received: from mail.kix.es ([46.105.17.89]:40677 "EHLO what.com.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758324Ab3HNRxZ (ORCPT ); Wed, 14 Aug 2013 13:53:25 -0400 X-Greylist: delayed 622 seconds by postgrey-1.27 at vger.kernel.org; Wed, 14 Aug 2013 13:53:25 EDT Received: from kix.es (4.Red-217-127-226.staticIP.rima-tde.net [217.127.226.4]) by what.com.es (Postfix) with ESMTPSA id 371526A108E; Wed, 14 Aug 2013 19:43:01 +0200 (CEST) Date: Wed, 14 Aug 2013 19:42:58 +0200 From: Rodolfo =?utf-8?B?R2FyY8OtYSBQZcOxYXM=?= To: linux-pm@vger.kernel.org Cc: rjw@sisk.pl Subject: [PATCH] suspend-utils: checksum buffer length error Message-ID: <20130814174258.GA3178@kix.es> Reply-To: kix@kix.es MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From bd16d8764e7606182f2871dd99b76b10df7ca9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= 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) --- 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);