bugTiny C Compiler - Bugs: bug #64476, TinyCC v0.9.27 - `tcc -o/dev/null`...


bug #64476: TinyCC v0.9.27 - `tcc -o/dev/null` unlinks /dev/null when run as root

Submitter:  None
Submitted:  Wed 26 Jul 2023 05:59:57 PM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Wed 26 Jul 2023 05:59:57 PM UTC, original submission:  

I am currently working on a setuid programme. My configure script passes '-o/dev/null' to compilers when it tests for features. Once I ran my configure script for TinyCC as root -- and it replaced /dev/null with a binary.

The behaviour is easy enough to reproduce:

$ tcc -v
tcc version 0.9.27 (x86_64 Linux)
$ ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Jul 26 17:46 /dev/null
$ cat <<eof >foo.c
int main(void) { return 0; }
$ sudo tcc -o/dev/null foo.c
$ ls -l /dev/null
-rwxr-xr-x 1 root root 3128 Jul 26 17:49 /dev/null

Sure, in a way, that's technically correct, but still I think it'd be good if that were changed ;-).



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.


No changes have been made to this item

Back to the top

Powered by Savane 3.12.
Corresponding source code