This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bogosity in jcf-path.c


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]