Skip to content

Bad Decoding #561

Description

@GalRogozinski

In

func (c *Controller) Decode(data []byte) error {
err := json.Unmarshal(data, &c)
if err != nil {
return errors.Wrap(err, "could not decode controller")
}
config := c.GetConfig()
for _, i := range c.StoredInstances {
if i != nil {
i.config = config
}
}
return nil
}
there seems to be a mistake.

err := json.Unmarshal(data, &c)

Here, c is a pointer receiver (*Controller), so &c is a pointer to a pointer (**Controller), which is not what json.Unmarshal expects. This results in unexpect deserialization.

Same issue in instance decoding.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions