Bogosity in jcf-path.c

Andrew Haley aph@redhat.com
Fri Nov 28 18:22:00 GMT 2003


I'm looking at this code:

static void
add_entry (struct entry **entp, const char *filename, int is_system)
{
  int len;
  struct entry *n;

  n = ALLOC (sizeof (struct entry));
  n->flags = is_system ? FLAG_SYSTEM : 0;
  n->next = NULL;

  len = strlen (filename);

  if (len > 4 && (FILENAME_CMP (filename + len - 4, ".zip") == 0
		  || FILENAME_CMP (filename + len - 4, ".jar") == 0))
    {
      n->flags |= FLAG_ZIP;
 
So, we compare the filename to blah.zip and conclude that it's a
zipfile.  But what if blah.zip is a directory?  Surely we need to open
the file and test for the magic value.

Andrew.



More information about the Java mailing list