emacs-devel
[Top][All Lists]
Advanced

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

Bug in filelock.c


From: Eli Zaretskii
Subject: Bug in filelock.c
Date: Sat, 23 Feb 2013 21:07:09 +0200

The marked line from filelock.c seems to have such a glaring bug that
I'm questioning my own judgment:

  /* Shift the nondirectory part of the file name (including the null)
     right two characters.  Here is one of the places where we'd have to
     do something to support 14-character-max file names.  */
  for (p = lockfile + length; p != lockfile && *p != '/'; p--)
    p[2] = *p;

  /* Insert the `.#'.  */
  p[1] = '.';
  p[2] = '#';

  p = p + length + 2;
  ^^^^^^^^^^^^^^^^^^

I think it should say this instead:

  p = lockfile + length + 2

I guess no one ever had a situation where a numeric tail was needed,
because then fill_in_lock_file_name would corrupt the stack.  Or maybe
on most machines nowadays arguments are not passed on the stack, even
in a non-optimized build.

Am I missing something?



reply via email to

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