runtime.RawExtension must copy the buffer, not use it

This commit is contained in:
Clayton Coleman
2014-09-22 15:56:28 -04:00
parent 71c1137213
commit 9a0add3c96

View File

@@ -17,11 +17,16 @@ limitations under the License.
package runtime
import (
"errors"
"gopkg.in/v1/yaml"
)
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
}