summaryrefslogtreecommitdiff
path: root/libopeniscsiusr
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2018-11-06 11:16:06 -0800
committerLee Duncan <lduncan@suse.com>2018-11-06 11:16:06 -0800
commit24ce8f62e042e69497e1299212504c356179e15b (patch)
treed86fed9cad1fd04592250c7f921ab98b30b2bb66 /libopeniscsiusr
parent0b3f90d89532406a1a10121c781d9fba91d262e8 (diff)
downloadopen-iscsi-24ce8f62e042e69497e1299212504c356179e15b.tar.gz
Fix i586 build issues with string length overflow.
Gcc7 warns of possible string print overflow, on i586, when printing password length (via a macro), generating errors like: [ 59s] ^~~~~~~~~~~~~~~~~~~~ [ 59s] In file included from /usr/include/stdio.h:862:0, [ 59s] from idbm.h:27, [ 59s] from context.h:22, [ 59s] from idbm.c:59: [ 59s] /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 2 and 11 bytes into a destination of size 8 [ 59s] return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, [ 59s] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ [ 59s] __bos (__s), __fmt, __va_arg_pack ()); [ 59s] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [ 59s] cc1: all warnings being treated as errors [ 59s] make[1]: *** [<builtin>: idbm.o] Error 1 [ 59s] make[1]: Leaving directory The fix is to limit the size of the string printed, so that no overflow is possible. The print macros in usr/idbm.c were updated, as well, to match the newer version in libopeniscsiusr/idbm.c, also to help the i586 build.
Diffstat (limited to 'libopeniscsiusr')
-rw-r--r--libopeniscsiusr/idbm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c
index 7724de2..055dd9a 100644
--- a/libopeniscsiusr/idbm.c
+++ b/libopeniscsiusr/idbm.c
@@ -676,7 +676,7 @@ updated:
if (!passwd_done && !strcmp(#_param, name)) { \
passwd_done = 1; \
name = #_param "_length"; \
- snprintf(passwd_len, 8, "%d", (int)strlen(value)); \
+ snprintf(passwd_len, 8, "%.7d", (int)strlen(value) & 0xffff); \
value = passwd_len; \
goto setup_passwd_len; \
}