diff options
author | Jim Meyering <meyering@redhat.com> | 2007-10-07 22:58:29 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2007-10-08 10:26:05 +0200 |
commit | 689186b88ccf025664ca24ac8efa68699f12d85d (patch) | |
tree | b6faf98bf79d91a4fbf2dee8ff1c47fd439f3999 /src/c99-to-c89.diff | |
parent | 035a5ca2b0fb83ca179ed7739e18bb60437bc525 (diff) | |
download | coreutils-689186b88ccf025664ca24ac8efa68699f12d85d.tar.xz |
rm could malfunction under unusual circumstances:
When operating on a relative name longer than 511 bytes,
and (when either processing a directory that is neither writable
nor readable (but still searchable) or when determining whether
to prompt), and encountering an ENOMEM error while forming the
file name, rm would operate on a truncated-to-511-byte name
starting with "[...]" rather than the intended one.
* NEWS: Describe the bugs.
* src/remove.c: Correct two misuses of full_filename:
(full_filename0, xfull_filename): New functions.
(full_filename_): Rewrite to use full_filename0.
(AD_pop_and_chdir): Use xfull_filename, not full_filename.
(write_protected_non_symlink): Likewise.
Diffstat (limited to 'src/c99-to-c89.diff')
-rw-r--r-- | src/c99-to-c89.diff | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/c99-to-c89.diff b/src/c99-to-c89.diff index 8a3737247..f6c7664ed 100644 --- a/src/c99-to-c89.diff +++ b/src/c99-to-c89.diff @@ -1,7 +1,7 @@ diff -upr src/remove.c src/remove.c --- src/remove.c 2007-07-23 12:56:20.000000000 +0200 +++ src/remove.c 2007-07-23 13:03:12.000000000 +0200 -@@ -257,9 +257,10 @@ pop_dir (Dirstack_state *ds) +@@ -262,9 +262,10 @@ pop_dir (Dirstack_state *ds) { size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t); size_t *length = obstack_base (&ds->len_stack); @@ -13,7 +13,7 @@ diff -upr src/remove.c src/remove.c assert (top_len >= 2); /* Pop the specified length of file name. */ -@@ -391,10 +392,11 @@ AD_stack_top (Dirstack_state const *ds) +@@ -419,10 +420,11 @@ AD_stack_top (Dirstack_state const *ds) static void AD_stack_pop (Dirstack_state *ds) { @@ -26,7 +26,7 @@ diff -upr src/remove.c src/remove.c if (top->unremovable) hash_free (top->unremovable); obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent)); -@@ -876,6 +878,7 @@ prompt (int fd_cwd, Dirstack_state const +@@ -904,6 +906,7 @@ prompt (int fd_cwd, Dirstack_state const break; } @@ -34,7 +34,7 @@ diff -upr src/remove.c src/remove.c char const *quoted_name = quote (full_filename (filename)); if (0 < write_protected) -@@ -915,6 +918,7 @@ prompt (int fd_cwd, Dirstack_state const +@@ -943,6 +946,7 @@ prompt (int fd_cwd, Dirstack_state const : _("%s: remove %s %s? ")), program_name, file_type (sbuf), quoted_name); } @@ -42,7 +42,7 @@ diff -upr src/remove.c src/remove.c if (!yesno ()) return RM_USER_DECLINED; -@@ -1534,6 +1538,7 @@ rm_1 (Dirstack_state *ds, char const *fi +@@ -1562,6 +1566,7 @@ rm_1 (Dirstack_state *ds, char const *fi return RM_ERROR; } @@ -50,7 +50,7 @@ diff -upr src/remove.c src/remove.c struct stat st; cache_stat_init (&st); cycle_check_init (&ds->cycle_check_state); -@@ -1556,6 +1561,7 @@ rm_1 (Dirstack_state *ds, char const *fi +@@ -1584,6 +1589,7 @@ rm_1 (Dirstack_state *ds, char const *fi AD_push_initial (ds); AD_INIT_OTHER_MEMBERS (); @@ -58,7 +58,7 @@ diff -upr src/remove.c src/remove.c enum RM_status status = remove_entry (AT_FDCWD, ds, filename, DT_UNKNOWN, &st, x); if (status == RM_NONEMPTY_DIR) -@@ -1574,6 +1580,8 @@ rm_1 (Dirstack_state *ds, char const *fi +@@ -1602,6 +1608,8 @@ rm_1 (Dirstack_state *ds, char const *fi ds_clear (ds); return status; } |