View | Details | Raw Unified
Collapse All | Expand All

(-) rpmoffset.c (-9 / +8 lines)
 Lines 11-33    Link Here 
/* chunk of RAM right away so that we have enough.  Yeah, horrible */
/* chunk of RAM right away so that we have enough.  Yeah, horrible */
/* quick and dirty implementation, but hey -- it gets the job done. */
/* quick and dirty implementation, but hey -- it gets the job done. */
#define RPMBUFSIZ 3145728
main()
main()
{
{
        char *buff = malloc(RPMBUFSIZ),*eb,*p;
        long int i;
        for (p = buff, eb = buff + read(0,buff,RPMBUFSIZ); p < eb; p++)
        char p[3];
        {
        for (i=0, read(0,p,1) && read(0,p+1,1) && read(0,p+2,1); p+2 != NULL; p[0]=p[1],p[1]=p[2],read(0,p+2,1),i++) {
                if (*p == '\037' && p[1] == '\213' && p[2] == '\010') 
                if (*p == '\037' && p[1] == '\213' && p[2] == '\010') 
                {
                {
                        printf("%ld\n",p - buff);
                        printf("%ld\n",i);
                        exit(0);
                        exit(0);
                }
                }
                else if (*p == 'B' && p[1] == 'Z' && p[2] == 'h' )
                else if (*p == 'B' && p[1] == 'Z' && p[2] == 'h' )
                {
                {
                        printf("%ld\n",p - buff);
                        printf("%ld\n",i);
                        exit(0);
                        exit(0);
                }
                }
        }
        }
        exit(1);
        exit(1);
}
}