about summary refs log tree commit diff
path: root/pkgs/games/humblebundle
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-03-07 04:38:29 +0100
committeraszlig <aszlig@nix.build>2018-03-07 04:38:29 +0100
commit15925535271fd588b156f514c9bd2f8823cfff6b (patch)
tree89cb3111e684734a6d8830a629d06be669b89da5 /pkgs/games/humblebundle
parentae58e2433a473ce2fdd32325a8e21329ed0cb63e (diff)
starbound: Fix preloader snprintf size
I explicitly didn't want to include a \0, but unfortunately with GCC 7 a
check is performed on the size of the format arguments and the build now
fails with:

'__builtin___snprintf_chk' output between 5 and 9 bytes into a
destination of size 4

The dereference of the str pointer gives us one byte, so the size of the
format argument will be 4 in any cases plus the 0 byte at the end. While
we don't need the 0 byte because it will be added later, it doesn't hurt
so let's use a maximum size of 5 to keep GCC 7 silent.

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/games/humblebundle')
-rw-r--r--pkgs/games/humblebundle/starbound.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/games/humblebundle/starbound.nix b/pkgs/games/humblebundle/starbound.nix
index 921f652b..2c63cb0d 100644
--- a/pkgs/games/humblebundle/starbound.nix
+++ b/pkgs/games/humblebundle/starbound.nix
@@ -118,7 +118,7 @@ let
             if (*str >= 0 && *str <= 31) {
               *out++ = '\\';
               *out++ = 'u';
-              snprintf(out, 4, "%04x", *str);
+              snprintf(out, 5, "%04x", *str);
               out += 4;
             } else {
               *out++ = *str;