Index: src/platform/vboot_reference/vkernel/kernel_image.c |
diff --git a/src/platform/vboot_reference/vkernel/kernel_image.c b/src/platform/vboot_reference/vkernel/kernel_image.c |
index e0b7a55d79c6bba2778e48bf228773aa0077e1e6..bda016553609cc23e8a8d7640f063af8d6997594 100644 |
--- a/src/platform/vboot_reference/vkernel/kernel_image.c |
+++ b/src/platform/vboot_reference/vkernel/kernel_image.c |
@@ -333,7 +333,7 @@ int WriteKernelImage(const char* output_file, |
if (!image) |
return 0; |
- if (-1 == (fd = creat(output_file, S_IRWXU))) { |
+ if (-1 == (fd = creat(output_file, 0666))) { |
debug("Couldn't open file for writing kernel image: %s\n", |
output_file); |
return 0; |
@@ -669,8 +669,11 @@ uint8_t* GenerateKernelBlob(const char* kernel_file, |
config_buf = BufferFromFile(config_file, &config_size); |
if (!config_buf) |
goto done1; |
- if (config_size < CROS_CONFIG_SIZE) // need room for trailing '\0' |
+ if (config_size >= CROS_CONFIG_SIZE) { // need room for trailing '\0' |
+ error("config file %s is too large (>= %d bytes)\n", |
+ config_file, CROS_CONFIG_SIZE); |
goto done1; |
+ } |
// Replace any newlines with spaces in the config file. |
for (i=0; i < config_size; i++) |
@@ -695,8 +698,10 @@ uint8_t* GenerateKernelBlob(const char* kernel_file, |
CROS_PARAMS_SIZE + |
roundup(bootloader_size, CROS_ALIGN); |
blob = (uint8_t *)Malloc(blob_size); |
- if (!blob) |
+ if (!blob) { |
+ error("Couldn't allocate %ld bytes.\n", blob_size); |
goto done3; |
+ } |
Memset(blob, 0, blob_size); |
now = 0; |