containous/staert

mapstructure's decoder doesn't zero fields by default

Opened this issue · 0 comments

gozer commented

This has been responsible for traefik/traefik#2153

The longer analysis is available in Traefik's issue, but in short, when loading a stored object from the KV store, it's important to zero the destination fields before loading it up, otherwise, mapstructure will just partially overwrite data, leaving possible extra data present.

In the case of Traaefik, this means a JSON array stored as bytes[] could come back with junk at the end if the new array was shorter than the previous one.