Using nb with 11 length may cause format-truncation errors,
because it was possible to use snprintf with 12 length input
and write it to 11 length output. Added new define and use it
to avoid this error.
Signed-off-by: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
#define PATH_MAX 4096
#endif
+/* The max string length necessary for decimal conversion, cannot be longer than count of bits */
+#define INT_2_DEC_STR_MAX (sizeof(int) * 8)
+
#define RESYNC_NONE -1
#define RESYNC_DELAYED -2
#define RESYNC_PENDING -3
d++) {
mdp_disk_t *dp;
char *dv;
- char nb[11];
+ char nb[INT_2_DEC_STR_MAX];
int wonly, failfast;
if (d>=0) dp = &sb->disks[d];
else dp = &sb->this_disk;