[PATCH] orinoco: fix setting of 32 character ESSIDs
authorChristoph Hellwig <hch@lst.de>
Sat, 14 May 2005 15:29:58 +0000 (17:29 +0200)
committerJeff Garzik <jgarzik@pobox.com>
Sun, 15 May 2005 21:53:25 +0000 (17:53 -0400)
Patch from Thomas Schulz

Index: linux-2.6/drivers/net/wireless/orinoco.c
===================================================================

drivers/net/wireless/orinoco.c

index d910b89..76875da 100644 (file)
@@ -2907,13 +2907,14 @@ static int orinoco_ioctl_setessid(struct net_device *dev, struct iw_point *erq)
        memset(&essidbuf, 0, sizeof(essidbuf));
 
        if (erq->flags) {
-               if (erq->length > IW_ESSID_MAX_SIZE)
+               /* iwconfig includes the NUL in the specified length */
+               if (erq->length > IW_ESSID_MAX_SIZE+1)
                        return -E2BIG;
                
                if (copy_from_user(&essidbuf, erq->pointer, erq->length))
                        return -EFAULT;
 
-               essidbuf[erq->length] = '\0';
+               essidbuf[IW_ESSID_MAX_SIZE] = '\0';
        }
 
        if (orinoco_lock(priv, &flags) != 0)