diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2010-03-05 11:51:09 +0100 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2010-03-05 15:05:35 +0100 |
commit | 24ba49c88d8a69d44d4e5059bdad223a3524ab2d (patch) | |
tree | e8629bbc0e29a559d64c7f2f7e6181d88aaace93 /lib | |
parent | 401d81946e98f70ed135f57522f58eeeff54cdb2 (diff) | |
download | grep-24ba49c88d8a69d44d4e5059bdad223a3524ab2d.tar.gz |
eliminate invalid "ptr += (ptr2 - ptr1)"
* lib/savedir.c (savedir): new_name_space and name_space do not point into
the same object, so computing their difference is invalid. Similarly,
summing the difference to namep is invalid because namep and the result
point into different objects. Avoid this.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/savedir.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/savedir.c b/lib/savedir.c index 45bf9c32..91fd77b9 100644 --- a/lib/savedir.c +++ b/lib/savedir.c @@ -140,7 +140,7 @@ savedir (const char *dir, off_t name_size, struct exclude *included_patterns, closedir (dirp); goto fail; } - namep += new_name_space - name_space; + namep = new_name_space + (namep - name_space); name_space = new_name_space; } strcpy (namep, dp->d_name); |