1 // Contributed by Alexandre Oliva <aoliva@redhat.com> 2 // From Red Hat case 106165. 3 4 typedef unsigned short (FUNC_P) (void *, unsigned char *, unsigned short); 5 crashIt(int id,FUNC_P * func,unsigned char * funcparm)6void crashIt(int id, FUNC_P *func, unsigned char *funcparm) 7 { 8 unsigned char buff[5], reverse[4]; 9 unsigned char *bp = buff; 10 unsigned char *rp = reverse; 11 unsigned short int count = 0; 12 unsigned short cnt; 13 while (id > 0) 14 { 15 *rp++ = (unsigned char) (id & 0x7F); 16 id >>= 7; 17 count++; 18 } 19 cnt = count + 1; 20 while ((count--) > 1) 21 { 22 *bp++ = (unsigned char)(*(--rp) | 0x80); 23 } 24 *bp++ = *(--rp); 25 (void)(*func)(funcparm, buff, cnt); 26 } 27