Browse Source

Bugfix in resolvconf file manipulation

Yann Weber 5 years ago
parent
commit
4f1e402b83
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/andna_cache.c

+ 2
- 1
src/andna_cache.c View File

@@ -2046,10 +2046,11 @@ add_resolv_conf(char *hname, char *file)
2046 2046
 
2047 2047
   reread_fin:
2048 2048
 	fseek(fin, 0, SEEK_END);
2049
-	buf_sz = ftell(fin);
2049
+	buf_sz = ftell(fin)+1;
2050 2050
 	rewind(fin);
2051 2051
 
2052 2052
 	buf = xmalloc(buf_sz);
2053
+	memset(buf, 0, buf_sz);
2053 2054
 	if (!fread(buf, buf_sz, 1, fin)) {
2054 2055
 		error("add_resolv_conf: it wasn't possible to read the %s file",
2055 2056
 			  file);

Loading…
Cancel
Save