~ubuntu-branches/ubuntu/karmic/fastjar/karmic-security

« back to all changes in this revision

Viewing changes to jargrep.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-11-11 05:58:19 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20081111055819-y7rp49bl4rjmmlge
Tags: upstream-0.97
ImportĀ upstreamĀ versionĀ 0.97

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "config.h"
28
28
#endif
29
29
 
 
30
#include <ctype.h>
 
31
#include <errno.h>
 
32
#include <fcntl.h>
 
33
#include <inttypes.h>
30
34
#include <stdio.h>
31
 
#include <unistd.h>
32
 
#include <errno.h>
 
35
#include <stdint.h>
33
36
#include <string.h>
34
37
#include <sys/types.h>
35
38
#include <sys/stat.h>
36
 
#include <fcntl.h>
37
 
#include <ctype.h>
 
39
#ifdef HAVE_UNISTD_H
 
40
#include <unistd.h>
 
41
#endif
38
42
#ifdef HAVE_STDLIB_H
39
43
#include <stdlib.h>
40
44
#endif
132
136
do some more reading.
133
137
*/
134
138
static int check_sig(ub1 *scratch, pb_file *pbfp) {
135
 
        ub4 signature;
 
139
        uint32_t signature;
136
140
        int retflag = 0;
137
141
 
138
142
        signature = UNPACK_UB4(scratch, 0);
152
156
#endif
153
157
      retflag = 1;
154
158
    }else if(signature != 0x04034b50){
155
 
      printf("Ick! %#x\n", signature);
 
159
      printf("Ick! %#" PRIx32 "\n", signature);
156
160
      retflag = 1;
157
161
    }
158
162
    
386
390
*/
387
391
 
388
392
static void check_crc(pb_file *pbf, const char *stream, ub4 usize) {
389
 
        ub4 crc=0;
390
 
        ub4 lcrc;
 
393
        uint32_t crc=0;
 
394
        uint32_t lcrc;
391
395
        ub1 scratch[16];
392
396
 
393
397
        crc = crc32(crc, NULL, 0);
402
406
        }
403
407
        lcrc = UNPACK_UB4(scratch, 4);
404
408
        if(crc != lcrc){
405
 
        fprintf(stderr, "Error! CRCs do not match! Got %x, expected %x\n",
406
 
              crc, lcrc);
 
409
        fprintf(stderr, "Error! CRCs do not match! Got %" PRIx32 
 
410
                        ", expected %" PRIx32 "\n",
 
411
                crc, lcrc);
407
412
        exit(EXIT_FAILURE);
408
413
    }
409
414
}