Skip to content

Commit

Permalink
miniogw: fix metainfo: invalid direction 0 list error
Browse files Browse the repository at this point in the history
Calling list.Next() after it has returned false gives an invalid
direction error, a sort of double free type gotcha. libuplink may fix
this in the future but there's no point calling it again after it has
returned false anyways.

Closes #70

Change-Id: I5e6031b50ba88194348c2567b271f3fef92ef2c6
  • Loading branch information
pwilloughby committed Feb 7, 2023
1 parent dc69596 commit 4b4e51e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions miniogw/gateway.go
Expand Up @@ -285,7 +285,8 @@ func (layer *gatewayLayer) listObjectsFast(

limit := limitResults(maxKeys, layer.compatibilityConfig.MaxKeysLimit)

for limit > 0 && list.Next() {
var more bool
for more = list.Next(); limit > 0 && more; more = list.Next() {
item := list.Item()

limit--
Expand All @@ -302,11 +303,6 @@ func (layer *gatewayLayer) listObjectsFast(
return nil, nil, "", list.Err()
}

more := list.Next()
if list.Err() != nil {
return nil, nil, "", list.Err()
}

if !more {
nextContinuationToken = ""
}
Expand Down

0 comments on commit 4b4e51e

Please sign in to comment.