File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,11 @@ static int parse_ip_list() {
340
340
return -1 ;
341
341
}
342
342
while ((line = fgets (line_buf , len , fp ))) {
343
+ char * sp_pos ;
344
+ sp_pos = strchr (line , '\r' );
345
+ if (sp_pos ) * sp_pos = 0 ;
346
+ sp_pos = strchr (line , '\n' );
347
+ if (sp_pos ) * sp_pos = 0 ;
343
348
inet_aton (line , & ip_list .ips [i ]);
344
349
i ++ ;
345
350
}
@@ -391,7 +396,12 @@ static int parse_chnroute() {
391
396
return -1 ;
392
397
}
393
398
while ((line = fgets (line_buf , len , fp ))) {
394
- char * sp_pos = strchr (line , '/' );
399
+ char * sp_pos ;
400
+ sp_pos = strchr (line , '\r' );
401
+ if (sp_pos ) * sp_pos = 0 ;
402
+ sp_pos = strchr (line , '\n' );
403
+ if (sp_pos ) * sp_pos = 0 ;
404
+ sp_pos = strchr (line , '/' );
395
405
if (sp_pos ) {
396
406
* sp_pos = 0 ;
397
407
chnroute_list .nets [i ].mask = (1 << (32 - atoi (sp_pos + 1 ))) - 1 ;
You can’t perform that action at this time.
0 commit comments