projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1be0c28
)
Fix segfault when adding environment variables.
author
Guus Sliepen
<guus@tinc-vpn.org>
Mon, 17 Apr 2017 11:53:48 +0000
(13:53 +0200)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Mon, 17 Apr 2017 11:53:48 +0000
(13:53 +0200)
src/script.c
patch
|
blob
|
history
diff --git
a/src/script.c
b/src/script.c
index
1ce59ea
..
d65551a
100644
(file)
--- a/
src/script.c
+++ b/
src/script.c
@@
-64,7
+64,7
@@
static void putenv(const char *p) {}
static void unputenv(const char *p) {}
#endif
static void unputenv(const char *p) {}
#endif
-static const int min_env_size;
+static const int min_env_size
= 10
;
int environment_add(environment_t *env, const char *format, ...) {
if(env->n >= env->size) {
int environment_add(environment_t *env, const char *format, ...) {
if(env->n >= env->size) {
@@
-95,7
+95,7
@@
void environment_update(environment_t *env, int pos, const char *format, ...) {
void environment_init(environment_t *env) {
env->n = 0;
env->size = min_env_size;
void environment_init(environment_t *env) {
env->n = 0;
env->size = min_env_size;
- env->entries =
0; //
xzalloc(env->size * sizeof *env->entries);
+ env->entries = xzalloc(env->size * sizeof *env->entries);
if(netname)
environment_add(env, "NETNAME=%s", netname);
if(netname)
environment_add(env, "NETNAME=%s", netname);