瀏覽代碼

getline handling bug

tags/v1.1.0
Pascal Gloor 5 年之前
父節點
當前提交
c66a53ecea
共有 2 個檔案被更改,包括 7 行新增2 行删除
  1. 2
    1
      src/Makefile
  2. 5
    1
      src/dp_helpers.c

+ 2
- 1
src/Makefile 查看文件

############################################################################### ###############################################################################


CC := gcc CC := gcc
CCFLAGS := -Wall -Werror -pedantic -O2 -I../inc
CCFLAGS := -Wall -Werror -pedantic -O2
#CCFLAGS := -Wall -Werror -pedantic -g
LDFLAGS := -lnetfilter_queue -lpthread LDFLAGS := -lnetfilter_queue -lpthread


TARGETS:= dhcp_protect TARGETS:= dhcp_protect

+ 5
- 1
src/dp_helpers.c 查看文件

int error = 0; int error = 0;


printf("Loading configuration %s\n",file); printf("Loading configuration %s\n",file);

memset(conf, 0, sizeof(dp_conf));


if ( ( fh = fopen(file,"r") ) == NULL ) { if ( ( fh = fopen(file,"r") ) == NULL ) {
fprintf(stderr,"Failed to open configuration file '%s': %s\n", file, strerror(errno)); fprintf(stderr,"Failed to open configuration file '%s': %s\n", file, strerror(errno));
fprintf(stderr,"unknown directive '%s', ignored\n", name); fprintf(stderr,"unknown directive '%s', ignored\n", name);


free(line); free(line);
len=0;
line=NULL;
} }

fclose(fh); fclose(fh);


if ( conf->pktint < 1 || conf->pktint > 1000 ) { if ( conf->pktint < 1 || conf->pktint > 1000 ) {

Loading…
取消
儲存