Thread (6 messages) 6 messages, 2 authors, 2006-09-22

Re: [PATCH]d80211: fix "iwconfig key [x]" behavior

From: Jiri Benc <hidden>
Date: 2006-09-21 15:51:11

Hi,

sorry for the delay.

On Fri, 01 Sep 2006 11:37:57 +0800, Hong Liu wrote:
quoted hunk ↗ jump to hunk
@@ -2925,7 +2932,8 @@ static int ieee80211_ioctl_giwencode(str
 		return 0;
 	}
 
-	erq->length = 0;
+	erq->length = min((int)erq->length, sdata->keys[idx]->keylen);
+	memcpy(key, sdata->keys[idx]->key, erq->length);
 	erq->flags |= IW_ENCODE_ENABLED;
 
 	return 0;
This is still not correct, erq->length should be set to the actual key
length to allow WE to return -E2BIG in case of too small buffer.

	memcpy(key, sdata->keys[idx]->key,
	       min((int)erq->length, sdata->keys[idx]->keylen));
	erq->length = sdata->keys[idx]->keylen;

 Jiri

-- 
Jiri Benc
SUSE Labs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help