From: Dan Williams Date: Thu, 25 Sep 2008 05:48:19 +0000 (-0700) Subject: md: fix input truncation in safe_delay_store() X-Git-Tag: upstream/snapshot3+hdmi~22084^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97ce0a7f9caf9d715cee815a016ee21575f71c95;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git md: fix input truncation in safe_delay_store() safe_delay_store() currently truncates the last character of input since it tells strlcpy that the buffer can only hold 'len' characters, off by one. sysfs already null terminates the buffer, so just increase the last argument to strlcpy. Signed-off-by: Dan Williams Signed-off-by: NeilBrown --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 39c9c87..aaa3d46 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2394,12 +2394,11 @@ safe_delay_store(mddev_t *mddev, const char *cbuf, size_t len) int i; unsigned long msec; char buf[30]; - char *e; + /* remove a period, and count digits after it */ if (len >= sizeof(buf)) return -EINVAL; - strlcpy(buf, cbuf, len); - buf[len] = 0; + strlcpy(buf, cbuf, sizeof(buf)); for (i=0; i