Fix: issue 380
diff --git a/protocol/dubbo/codec.go b/protocol/dubbo/codec.go
index 6b41d5e..1d3cfc2 100644
--- a/protocol/dubbo/codec.go
+++ b/protocol/dubbo/codec.go
@@ -75,7 +75,13 @@
 }
 
 func (p *DubboPackage) Unmarshal(buf *bytes.Buffer, opts ...interface{}) error {
-	codec := hessian.NewHessianCodec(bufio.NewReaderSize(buf, buf.Len()))
+	// fix issue https://github.com/apache/dubbo-go/issues/380
+	bufLen := buf.Len()
+	if bufLen < hessian.HEADER_LENGTH {
+		return perrors.WithStack(hessian.ErrHeaderNotEnough)
+	}
+
+	codec := hessian.NewHessianCodec(bufio.NewReaderSize(buf, bufLen))
 
 	// read header
 	err := codec.ReadHeader(&p.Header)
diff --git a/protocol/dubbo/codec_test.go b/protocol/dubbo/codec_test.go
index 149644a..02ce02d 100644
--- a/protocol/dubbo/codec_test.go
+++ b/protocol/dubbo/codec_test.go
@@ -18,6 +18,7 @@
 package dubbo
 
 import (
+	"bytes"
 	"testing"
 	"time"
 )
@@ -25,6 +26,7 @@
 import (
 	hessian "github.com/apache/dubbo-go-hessian2"
 	"github.com/stretchr/testify/assert"
+	perrors "github.com/pkg/errors"
 )
 
 func TestDubboPackage_MarshalAndUnmarshal(t *testing.T) {
@@ -72,3 +74,10 @@
 	assert.Equal(t, []interface{}{"a"}, pkgres.Body.([]interface{})[5])
 	assert.Equal(t, map[string]string{"dubbo": "2.0.2", "interface": "Service", "path": "path", "timeout": "1000", "version": "2.6"}, pkgres.Body.([]interface{})[6])
 }
+
+func TestIssue380(t *testing.T) {
+	pkg := &DubboPackage{}
+	buf := bytes.NewBuffer([]byte("hello"))
+	err := pkg.Unmarshal(buf)
+    assert.True(t, perrors.Cause(err) == hessian.ErrHeaderNotEnough)
+}
\ No newline at end of file