bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

3 .92 bugs


From: Gary Poppitz
Subject: 3 .92 bugs
Date: Mon, 6 May 2002 17:08:05 -0700

Some of the wormies I located on my way....


In fsys_tftp.c: line ~392

      /* Read the data.  */
      if (! buf_fill (0))
        {
          errnum = ERR_READ;
          return 0;
        }
I think it is better to do       if (size > 0 && ! buf_fill (0))
Otherwise, large file xfers get confused with extra RRQ's.



In builtins.c : install_func

#endif /* GRUB_UTIL */
    {
      /* The first.  */
      current_drive = src_drive;           //These two are clearly wrong
      current_partition = src_partition;

      if (! open_partition ())
        goto fail;

      if (! devwrite (stage2_first_sector - src_part_start, 1,
                      stage2_first_buffer))
        goto fail;


Since we are writing out our stuff, better point to the dest drive!







struct builtin *
find_command (char *command)
{
  char *ptr;
  char c;
  struct builtin **builtin;

  /* Find the first space and terminate the command name.  */
  ptr = command;
  while (*ptr && *ptr != ' ' && *ptr != '\t' && *ptr != '=')
    ptr ++;

  c = *ptr;
  *ptr = 0;

  /* Seek out the builtin whose command name is COMMAND.  */
  for (builtin = builtin_table; *builtin != 0; builtin++)
    {
      int ret = grub_strcmp (command, (*builtin)->name);

      if (ret == 0)
        {
          /* Find the builtin for COMMAND.  */
          *ptr = c;
          return *builtin;
        }
      else if (ret < 0) // this is not  a good idea
        break;
    }

  

Since the strcmp is an arithmetic compare, returning <0 is quite legal.
This will cause the search to terminate too soon. How this worked at all I 
dont know.



Also, when there is nothing else to do, removing the hoarde of globals in 
this code would be a great improvement. Just try to do a copy function from 
one drive to another with the current setup.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]