lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1321420292-26970-1-git-send-email-vbyravarasu@nvidia.com>
Date:	Wed, 16 Nov 2011 10:41:32 +0530
From:	vbyravarasu@...dia.com
To:	dbrownell@...rs.sourceforge.net, torvalds@...ux-foundation.org,
	akpm@...ux-foundation.org, a.zummo@...ertech.it, bunk@...nel.org,
	linux-kernel@...r.kernel.org
Cc:	venu byravarasu <vbyravarasu@...dia.com>
Subject: [PATCH] bcd: limit bin2bcd input value to lie between 0-99

From: venu byravarasu <vbyravarasu@...dia.com>

Current implementation of bin2bcd allows any value
between 0x0 to 0xF to be stored in the most significant
nibble of its returned value, against to the BCD limits
of 0 - 9. Hence fixing it.

e.g. say val passed to bin2bcd is 123.
In that case the expected value to be returned by
this function is 0x23.
However, without the fix being added, it would
return 0xC3.

Signed-off-by: venu byravarasu <vbyravarasu@...dia.com>
---
 lib/bcd.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/bcd.c b/lib/bcd.c
index d74257f..d715474 100644
--- a/lib/bcd.c
+++ b/lib/bcd.c
@@ -9,6 +9,7 @@ EXPORT_SYMBOL(bcd2bin);
 
 unsigned char bin2bcd(unsigned val)
 {
+	val %= 100;
 	return ((val / 10) << 4) + val % 10;
 }
 EXPORT_SYMBOL(bin2bcd);
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ