Skip to content

Commit c9e3f9f

Browse files
authored
Merge pull request #51 from funbox/develop
Version 0.20.3
2 parents ee53821 + e79b522 commit c9e3f9f

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
// App props
3333
const (
3434
APP = "init-exporter"
35-
VER = "0.20.2"
35+
VER = "0.20.3"
3636
DESC = "Utility for exporting services described by Procfile to init system"
3737
)
3838

common/init-exporter.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
Summary: Utility for exporting services described by Procfile to init system
4444
Name: init-exporter
45-
Version: 0.20.2
45+
Version: 0.20.3
4646
Release: 0%{?dist}
4747
Group: Development/Tools
4848
License: MIT
@@ -111,6 +111,9 @@ rm -rf %{buildroot}
111111
################################################################################
112112

113113
%changelog
114+
* Mon Oct 29 2018 Anton Novojilov <andyone@fun-box.ru> - 0.20.3-0
115+
- Fixed bug with parsing v1 procfile (found by go-fuzz)
116+
114117
* Wed Jul 25 2018 Anton Novojilov <andyone@fun-box.ru> - 0.20.2-0
115118
- Fixed formatting error in help content
116119

procfile/procfile_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ func (s *ProcfileSuite) TestProcV1Parsing(c *C) {
6767
c.Assert(app.Validate(), HasLen, 0)
6868
}
6969

70+
func (s *ProcfileSuite) TestProcV1Fuzz(c *C) {
71+
// Bug #1 found by fuzz testing
72+
_, err := parseV1Line("0:cd")
73+
74+
c.Assert(err, NotNil)
75+
}
76+
7077
func (s *ProcfileSuite) TestProcV2Parsing(c *C) {
7178
app, err := Read("../testdata/procfile_v2", s.Config)
7279

procfile/procfile_v1.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,20 @@ func parseV1Line(line string) (*Service, error) {
8989
return nil, fmt.Errorf("Procfile v1 should have format: 'some_label: command'")
9090
}
9191

92-
return parseV1Command(matches[1], matches[2]), nil
92+
return parseV1Command(matches[1], matches[2])
9393
}
9494

9595
// parseV1Command parse command and extract command and working dir
96-
func parseV1Command(name, command string) *Service {
96+
func parseV1Command(name, command string) (*Service, error) {
9797
var service = &Service{Name: name, Options: &ServiceOptions{}}
9898

9999
cmdSlice := splitV1Command(command)
100100

101101
if strings.HasPrefix(cmdSlice[0], "cd") {
102+
if len(cmdSlice) == 1 {
103+
return nil, fmt.Errorf("Procfile v1 command misformatted: %s", command)
104+
}
105+
102106
service.Options.WorkingDir = strings.Replace(cmdSlice[0], "cd ", "", -1)
103107
cmdSlice = cmdSlice[1:]
104108
}
@@ -129,7 +133,7 @@ func parseV1Command(name, command string) *Service {
129133
service.Options.Env = env
130134
service.Options.LogFile = log
131135

132-
return service
136+
return service, nil
133137
}
134138

135139
// splitV1Cmd split command and format command

0 commit comments

Comments
 (0)