mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
runtime.RawExtension must copy the buffer, not use it
This commit is contained in:
@@ -17,11 +17,16 @@ limitations under the License.
|
|||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"gopkg.in/v1/yaml"
|
"gopkg.in/v1/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (re *RawExtension) UnmarshalJSON(in []byte) error {
|
func (re *RawExtension) UnmarshalJSON(in []byte) error {
|
||||||
re.RawJSON = in
|
if re == nil {
|
||||||
|
return errors.New("runtime.RawExtension: UnmarshalJSON on nil pointer")
|
||||||
|
}
|
||||||
|
re.RawJSON = append(re.RawJSON[0:0], in...)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user