projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
628bd04
)
Add a missing check for a pathname being too long.
author
Guus Sliepen
<guus@tinc-vpn.org>
Mon, 26 Aug 2019 09:22:53 +0000
(11:22 +0200)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Mon, 26 Aug 2019 09:22:53 +0000
(11:22 +0200)
src/conf.c
patch
|
blob
|
history
diff --git
a/src/conf.c
b/src/conf.c
index
58d7b6d
..
3f81877
100644
(file)
--- a/
src/conf.c
+++ b/
src/conf.c
@@
-467,9
+467,14
@@
static void disable_old_keys(const char *filename) {
return;
}
- snprintf(tmpfile, sizeof(tmpfile), "%s.tmp", filename);
+
int len =
snprintf(tmpfile, sizeof(tmpfile), "%s.tmp", filename);
- w = fopen(tmpfile, "w");
+ if(len < 0 || len >= PATH_MAX) {
+ fprintf(stderr, "Pathname too long: %s.tmp\n", filename);
+ w = NULL;
+ } else {
+ w = fopen(tmpfile, "w");
+ }
while(fgets(buf, sizeof(buf), r)) {
if(!strncmp(buf, "-----BEGIN RSA", 14)) {