diff options
| author | dev <dev@example> | 2026-11-13 20:34:17 +0000 |
|---|---|---|
| committer | dev <dev@example> | 2026-11-13 20:34:17 +0000 |
| commit | e755a181b0e4c952c35d80e2aa1acd584d2e4595 (patch) | |
| tree | 2e176a3946acc7999149092dd4fdfcbe2cb7c987 /src/glob.c | |
| parent | 1fd64267f678b8c6d17b2bcae702d577df1fc9e4 (diff) | |
| download | access-control-e755a181b0e4c952c35d80e2aa1acd584d2e4595.tar.gz access-control-e755a181b0e4c952c35d80e2aa1acd584d2e4595.zip | |
Editing: options anywhere, a file that is not there yet, one owner per line
Three things the editing commands got wrong, two of them in the same
direction - taking an argument for something it is not.
--out and --stdout were only accepted before the names, which is not where
people put them, and "grant bob team write --out /tmp/new.conf" therefore
granted a ref pattern called "--out" and wrote it into the file. Options are
now pulled out from wherever they sit and what is left compacted, and a name
that starts with "--" is reported as the typo it is rather than granted.
A file that does not exist was refused with "create one with --out", which
tells the operator to do by hand what the command exists to do. grant and
protect now start the file, grammar written at the top of it, and say so in
the report; revoke reports that there was nothing to remove. A file that does
not parse is still refused: editing something the parser cannot read would
rewrite the parts that parse and keep the damage.
And the line array. rule_text() handed its buffer to the array while the
command also freed it, and protect handed a string literal to an array whose
free function frees every entry it holds: the first was a use-after-free and
the second corrupted the heap badly enough to write garbage into the file being
edited. One owner per line now, the copy made where the array takes it, and
finish() - where every command ends - releases the file it read.
Found by running the suite against AddressSanitizer, which is why `make
sanitizer` exists and why everything frees what it read: a process that exits
in a millisecond does not need the memory back, but it does need that report to
stay empty, or the one real leak hides among forty.
Diffstat (limited to 'src/glob.c')
0 files changed, 0 insertions, 0 deletions
