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

Re: Strange behavior while copying files



On Fri, Aug 10, 2001 at 12:35:32AM -0400, Roland McGrath wrote:
> It's not possible to read it either--it only ever reads one disk block.
> However, looking at the code in ext2fs/inode.c:diskfs_get_translator,
> it's clearly not robust to bogus data on the disk.

I saw you fixed that.  I wonder about null-termination.  It doesn't seem to
me we null-terminate the result in the translator nor in libdiskfs.  Isn't
necessary anyway, as we pass the length.

But in showtrans we have:

          char buf[1024], *trans = buf;
          int trans_len = sizeof (buf);
          error_t err = file_get_translator (node, &trans, &trans_len);

          switch (err)
            {
            case 0:
              /* Make the '\0's in TRANS printable.  */
              argz_stringify (trans, trans_len, ' ');

              if (!silent)
                {
                  if (print_prefix)
                    printf ("%s: %s\n", name, trans);
                  else
                    puts (trans);
                }

Note the printf ("%s: %s\n", name, trans), which seems quite bogus.
BTW, why should there be zeros in this string?

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



Reply to: