 6f374faca5
			
		
	
	
		6f374faca5
		
	
	
	
	
		
			
			This patch provides basic protection against damage resulting from differently compiled servers blindly copying tables to one another. In every getsysinfo() call, the caller is provided with the expected size of the requested data structure. The callee fails the call if the expected size does not match the data structure's actual size.
		
			
				
	
	
		
			20 lines
		
	
	
		
			430 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			430 B
		
	
	
	
		
			C
		
	
	
	
	
	
| 
 | |
| #include <lib.h>
 | |
| #include <minix/sysinfo.h>
 | |
| #include <minix/com.h>
 | |
| 
 | |
| PUBLIC int getsysinfo(
 | |
|   endpoint_t who,		/* from whom to request info */
 | |
|   int what,			/* what information is requested */
 | |
|   void *where,			/* where to put it */
 | |
|   size_t size 			/* how big it should be */
 | |
| )
 | |
| {
 | |
|   message m;
 | |
|   m.SI_WHAT = what;
 | |
|   m.SI_WHERE = where;
 | |
|   m.SI_SIZE = size;
 | |
|   if (_syscall(who, COMMON_GETSYSINFO, &m) < 0) return(-1);
 | |
|   return(0);
 | |
| }
 |