aboutsummaryrefslogtreecommitdiff
path: root/args.go
diff options
context:
space:
mode:
authorGravatar hs son <shspink2@gmail.com> 2022-11-15 01:15:41 +0900
committerGravatar GitHub <noreply@github.com> 2022-11-14 18:15:41 +0200
commitc57a2ce871dd67288f6339b2cc92a2fd3421ad50 (patch)
tree8ac548aa13cc6df2687878fe36dd195ea2111363 /args.go
parentRequest.SetTimeout (#1415) (diff)
downloadfasthttp-c57a2ce871dd67288f6339b2cc92a2fd3421ad50.tar.gz
fasthttp-c57a2ce871dd67288f6339b2cc92a2fd3421ad50.tar.bz2
fasthttp-c57a2ce871dd67288f6339b2cc92a2fd3421ad50.zip
Make sure nothing is nil in tmp slice (#1423)
Diffstat (limited to 'args.go')
-rw-r--r--args.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/args.go b/args.go
index 92e5d5a..c8fdccd 100644
--- a/args.go
+++ b/args.go
@@ -371,9 +371,10 @@ func visitArgsKey(args []argsKV, f func(k []byte)) {
func copyArgs(dst, src []argsKV) []argsKV {
if cap(dst) < len(src) {
tmp := make([]argsKV, len(src))
+ dstLen := len(dst)
dst = dst[:cap(dst)] // copy all of dst.
copy(tmp, dst)
- for i := len(dst); i < len(tmp); i++ {
+ for i := dstLen; i < len(tmp); i++ {
// Make sure nothing is nil.
tmp[i].key = []byte{}
tmp[i].value = []byte{}