projects
/
project
/
udebug.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a296f1b
)
ucode: check for errors in ftruncate()
master
author
Felix Fietkau
<nbd@nbd.name>
Wed, 6 Dec 2023 13:00:35 +0000
(14:00 +0100)
committer
Felix Fietkau
<nbd@nbd.name>
Wed, 6 Dec 2023 13:00:35 +0000
(14:00 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
lib-ucode.c
patch
|
blob
|
history
diff --git
a/lib-ucode.c
b/lib-ucode.c
index d50fd905c716ebe2b14585194d5e079412c5b093..c2ce3b24ea0c3d9763cfa4760d334b7b9df5e04b 100644
(file)
--- a/
lib-ucode.c
+++ b/
lib-ucode.c
@@
-327,7
+327,10
@@
uc_udebug_pcap_file(uc_vm_t *vm, size_t nargs)
if (ucv_type(file) == UC_STRING) {
fd = open(ucv_string_get(file), O_WRONLY | O_CREAT, 0644);
- ftruncate(fd, 0);
+ if (ftruncate(fd, 0) < 0) {
+ close(fd);
+ return NULL;
+ }
} else if (!file)
fd = STDOUT_FILENO;