Commit 8f455ef1 authored by SongLiangChen's avatar SongLiangChen

Read over 4096 length values

parent 053a0753
...@@ -78,15 +78,37 @@ func (ini *IniConfig) parseData(dir string, data []byte) (*IniConfigContainer, e ...@@ -78,15 +78,37 @@ func (ini *IniConfig) parseData(dir string, data []byte) (*IniConfigContainer, e
} }
} }
section := defaultSection section := defaultSection
tmpBuf := bytes.NewBuffer(nil)
for { for {
line, _, err := buf.ReadLine() tmpBuf.Reset()
if err == io.EOF {
break shouldBreak := false
for {
tmp, isPrefix, err := buf.ReadLine()
if err == io.EOF {
shouldBreak = true
break
}
//It might be a good idea to throw a error on all unknonw errors?
if _, ok := err.(*os.PathError); ok {
return nil, err
}
tmpBuf.Write(tmp)
if isPrefix {
continue
}
if !isPrefix {
break
}
} }
//It might be a good idea to throw a error on all unknonw errors? if shouldBreak {
if _, ok := err.(*os.PathError); ok { break
return nil, err
} }
line := tmpBuf.Bytes()
line = bytes.TrimSpace(line) line = bytes.TrimSpace(line)
if bytes.Equal(line, bEmpty) { if bytes.Equal(line, bEmpty) {
continue continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment