protect against BSD pty w/ 20-bit minor
This commit is contained in:
		
							
								
								
									
										2
									
								
								free.1
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								free.1
									
									
									
									
									
								
							| @@ -36,6 +36,8 @@ The \fB\-V\fP displays version information. | |||||||
|  |  | ||||||
| .SH "SEE ALSO" | .SH "SEE ALSO" | ||||||
| .BR ps (1), | .BR ps (1), | ||||||
|  | .BR slabtop (1), | ||||||
|  | .BR vmstat (8), | ||||||
| .BR top(1) | .BR top(1) | ||||||
|  |  | ||||||
| .SH AUTHORS | .SH AUTHORS | ||||||
|   | |||||||
| @@ -146,6 +146,7 @@ static int guess_name(char *restrict const buf, unsigned maj, unsigned min){ | |||||||
|     } |     } | ||||||
|     tmpmin = min & 0x3f;  /* FALL THROUGH */ |     tmpmin = min & 0x3f;  /* FALL THROUGH */ | ||||||
|   case   3:      /* /dev/[pt]ty[p-za-o][0-9a-z] is 936 */ |   case   3:      /* /dev/[pt]ty[p-za-o][0-9a-z] is 936 */ | ||||||
|  |     if(tmpmin > 255) return 0;   // should never happen; array index protection | ||||||
|     t0 = "pqrstuvwxyzabcde"[tmpmin>>4]; |     t0 = "pqrstuvwxyzabcde"[tmpmin>>4]; | ||||||
|     t1 = "0123456789abcdef"[tmpmin&0x0f]; |     t1 = "0123456789abcdef"[tmpmin&0x0f]; | ||||||
|     sprintf(buf, "/dev/tty%c%c", t0, t1); |     sprintf(buf, "/dev/tty%c%c", t0, t1); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 albert
					albert