From: Craig Small Date: Sat, 24 Oct 2015 02:17:36 +0000 (+1100) Subject: free: use correct end sentinel X-Git-Tag: v3.3.12~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=97cde50b359781548ab1663010ca939e0f04e9cd;p=procps-ng free: use correct end sentinel When scaling values, the last item was integer 0 but the loop checked for character '0'. This was reported by 付腾桂 Thanks for the report and patch. --- diff --git a/free.c b/free.c index 6c72138c..f86ab951 100644 --- a/free.c +++ b/free.c @@ -148,7 +148,7 @@ static const char *scale_size(unsigned long size, int flags, struct commandline_ /* human readable output */ up = nextup; - for (i = 1; up[0] != '0'; i++, up++) { + for (i = 1; up[0] != 0; i++, up++) { switch (i) { case 1: if (4 >= snprintf(buf, sizeof(buf), "%ld%c", (long)size * 1024, *up))