瀏覽代碼

Bugfix in resolvconf file manipulation

Yann Weber 5 年之前
父節點
當前提交
4f1e402b83
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      src/andna_cache.c

+ 2
- 1
src/andna_cache.c 查看文件

@@ -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…
取消
儲存