diff options
author | Valery Piashchynski <[email protected]> | 2021-09-15 07:52:14 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-09-15 07:52:14 +0300 |
commit | e4c84c703c2c798e4fa8ff8cf97e5e59e81ef4ed (patch) | |
tree | 3d76486f35433ebcee5425c0eb64142301f6da55 | |
parent | 6846141b15ed69036cb180307fde34913e8c1b77 (diff) |
Check the len of the grpc chunks.
Signed-off-by: Valery Piashchynski <[email protected]>
-rw-r--r-- | plugins/grpc/proxy/proxy.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/grpc/proxy/proxy.go b/plugins/grpc/proxy/proxy.go index 14655e0d..9e406bbf 100644 --- a/plugins/grpc/proxy/proxy.go +++ b/plugins/grpc/proxy/proxy.go @@ -182,6 +182,11 @@ func wrapError(err error) error { chunks := strings.Split(err.Error(), "|:|") code := codes.Internal + // protect the slice access + if len(chunks) < 2 { + return err + } + if phpCode, errConv := strconv.ParseUint(chunks[0], 10, 32); errConv == nil { code = codes.Code(phpCode) } |