Skip to contentSkip to conversation

Buffer overflow in fs/devpts/root.c

PATCH New Jamie Lokier 1 participant 1 message Sep 30, 1998 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Buffer overflow in fs/devpts/root.c

I haven't tested this, but it should be self explanatory. I don't even use devpts, I just spotted this while reading.

If you look up a name like /dev/pts/9999 it'd get messy. If you look up /dev/pts/4294967296, it'd be accepted and a dentry kept for it. That's silly.

-- Jamie

tmp/root.c renamed from usr/src/linux/fs/devpts/root.c +4 -0
@@ -152,12 +152,16 @@
 		if ( *p < '1' || *p > '9' )
 			return 0;
 		entry = *p++ - '0';
+		if ( entry >= sbi->max_ptys )
+			return 0;
 
 		for ( i = dentry->d_name.len-1 ; i ; i-- ) {
 			if ( *p < '0' || *p > '9' )
 				return 0;
 			entry *= 10;
 			entry += (*p++ - '0');
+			if ( entry >= sbi->max_ptys )
+				return 0;
 		}
 	}
 	

----- end of patch -----

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/