sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig
authorSimon Glass <sjg@chromium.org>
Fri, 6 Mar 2015 20:19:02 +0000 (13:19 -0700)
committerSimon Glass <sjg@chromium.org>
Sat, 18 Apr 2015 17:11:37 +0000 (11:11 -0600)
Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/Kconfig
configs/sandbox_defconfig
include/configs/sandbox.h
include/configs/x86-common.h
lib/Kconfig

index b44f709..3f1401a 100644 (file)
@@ -7,6 +7,9 @@ config SYS_ARCH
 config USE_PRIVATE_LIBGCC
        default y
 
+config SYS_VSNPRINTF
+       default y
+
 choice
        prompt "Target select"
 
index b911c02..efc020f 100644 (file)
@@ -18,3 +18,4 @@ CONFIG_USB_STORAGE=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_SANDBOX_GPIO=y
+CONFIG_SYS_VSNPRINTF=y
index 5ad4761..f714298 100644 (file)
@@ -48,8 +48,6 @@
 #define CONFIG_CMD_FS_GENERIC
 #define CONFIG_CMD_MD5SUM
 
-#define CONFIG_SYS_VSNPRINTF
-
 #define CONFIG_CMD_GPIO
 
 #define CONFIG_CMD_GPT
index b378f58..9571c65 100644 (file)
@@ -16,7 +16,6 @@
  * (easy to change)
  */
 #define CONFIG_SHOW_BOOT_PROGRESS
-#define CONFIG_SYS_VSNPRINTF
 #define CONFIG_ZBOOT_32
 #define CONFIG_PHYSMEM
 #define CONFIG_DISPLAY_BOARDINFO_LATE
index c9d2767..d7fd219 100644 (file)
@@ -27,6 +27,15 @@ config SYS_HZ
          get_timer() must operate in milliseconds and this option must be
          set to 1000.
 
+config SYS_VSNPRINTF
+       bool "Enable safe version of sprintf()"
+       help
+         Since sprintf() can overflow its buffer, it is common to use
+         snprintf() instead, which knows the buffer size and can avoid
+         overflow. However, this does increase code size slightly (for
+         Thumb-2, about 420 bytes). Enable this option for safety when
+         using sprintf() with data you do not control.
+
 source lib/rsa/Kconfig
 
 menu "Hashing Support"