Skip to contentSkip to conversation

Fix a couple of problems with xt_SYSRQ

PATCH RESEND In review John Haxby 1 participant 2 messages Jun 25, 2010 netfilter

lore
Share & tools
lore

John Haxby

author
#0 lore raw

PATCH RESEND 1/1 Fix a couple of problems with xt_SYSRQ

The first problem is that the error response from crypto_alloc_hash() should be extracted from the pointer before setting the pointer to NULL.

The second error is that only the first half of the password hash is checked which slightly weakens the password checking.

---
 extensions/xt_SYSRQ.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
extensions/xt_SYSRQ.c +3 -3
index e0b6aa0..30fc112 100644
@@ -135,13 +135,13 @@ static unsigned int sysrq_tg(const void *pdata, uint16_t len)
 			"0123456789abcdef"[sysrq_digest[i] & 0xf];
 	}
 	sysrq_hexdigest[2*sysrq_digest_size] = '\0';
-	if (len - n < sysrq_digest_size) {
+	if (len - n < sysrq_digest_size*2) {
 		if (sysrq_debug)
 			printk(KERN_INFO KBUILD_MODNAME ": Short digest,"
 			       " expected %s\n", sysrq_hexdigest);
 		return NF_DROP;
 	}
-	if (strncmp(data + n, sysrq_hexdigest, sysrq_digest_size) != 0) {
+	if (strncmp(data + n, sysrq_hexdigest, sysrq_digest_size*2) != 0) {
 		if (sysrq_debug)
 			printk(KERN_INFO KBUILD_MODNAME ": Bad digest,"
 			       " expected %s\n", sysrq_hexdigest);
@@ -324,8 +324,8 @@ static int __init sysrq_crypto_init(void)
 		printk(KERN_WARNING KBUILD_MODNAME
 			": Error: Could not find or load %s hash\n",
 			sysrq_hash);
-		sysrq_tfm = NULL;
 		ret = PTR_ERR(sysrq_tfm);
+		sysrq_tfm = NULL;
 		goto fail;
 	}
 	sysrq_digest_size = crypto_hash_digestsize(sysrq_tfm);
Signature · 1 line
1.7.0.1
author
#1 lore raw
Quoted 5 lines · John Haxby

The first problem is that the error response from crypto_alloc_hash() should be extracted from the pointer before setting the pointer to NULL.

The second error is that only the first half of the password hash is checked which slightly weakens the password checking.

My apologies, this patch was corrupted by my mailer. The "[RESEND2]" following should be OK.

jch