Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

mapstructure's decoder doesn't zero fields by default #31

Open
gozer opened this issue Sep 21, 2017 · 0 comments
Open

mapstructure's decoder doesn't zero fields by default #31

gozer opened this issue Sep 21, 2017 · 0 comments
Labels

Comments

@gozer
Copy link

gozer commented Sep 21, 2017

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.

@ldez ldez added the bug label Sep 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants