summaryrefslogtreecommitdiffstats
path: root/lib/mbsalign.c
diff options
context:
space:
mode:
authorSami Kerola2014-11-22 00:11:31 +0100
committerSami Kerola2014-12-19 10:10:48 +0100
commitefb2fe5f5dc65d0d32444d9ad10e35dc2d6bc3a4 (patch)
tree878cf274a8ec066f7c8e315ebfd4129af4305ce6 /lib/mbsalign.c
parentsfdisk: in the usage text show -v for --version instead of -V (diff)
downloadkernel-qcow2-util-linux-efb2fe5f5dc65d0d32444d9ad10e35dc2d6bc3a4.tar.gz
kernel-qcow2-util-linux-efb2fe5f5dc65d0d32444d9ad10e35dc2d6bc3a4.tar.xz
kernel-qcow2-util-linux-efb2fe5f5dc65d0d32444d9ad10e35dc2d6bc3a4.zip
lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
This error was reported 155 times. lib/mbsalign.c:322:18: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long') Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'lib/mbsalign.c')
-rw-r--r--lib/mbsalign.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/mbsalign.c b/lib/mbsalign.c
index b307d19f7..052fec611 100644
--- a/lib/mbsalign.c
+++ b/lib/mbsalign.c
@@ -319,7 +319,7 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
{
/* FIXME: Should we pad with "figure space" (\u2007)
if non ascii data present? */
- while (n_spaces-- && (dest < dest_end))
+ for (/* nothing */; n_spaces && (dest < dest_end); n_spaces--)
*dest++ = ' ';
*dest = '\0';
return dest;