[dm-devel] [PATCH] multipath-tools: fix incorrect length for strncmp in uevent.c
Martin Wilck
mwilck at suse.com
Tue Sep 5 18:30:43 UTC 2017
On Tue, 2017-09-05 at 11:54 +0800, Guan Junxiong wrote:
> Cc: Martin Wilck <mwilck at suse.com>
> Signed-off-by: Junxiong Guan <guanjunxiong at huawei.com>
> ---
> libmultipath/uevent.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
> index eb44da56..a98633e7 100644
> --- a/libmultipath/uevent.c
> +++ b/libmultipath/uevent.c
> @@ -885,7 +885,7 @@ int uevent_get_disk_ro(struct uevent *uev)
> int i, ro = -1;
>
> for (i = 0; uev->envp[i] != NULL; i++) {
> - if (!strncmp(uev->envp[i], "DISK_RO", 6) &&
> strlen(uev->envp[i]) > 7) {
> + if (!strncmp(uev->envp[i], "DISK_RO", 7) &&
> strlen(uev->envp[i]) > 8) {
> p = uev->envp[i] + 8;
> ro = strtoul(p, &q, 10);
> if (p == q) {
> @@ -904,8 +904,8 @@ char *uevent_get_dm_name(struct uevent *uev)
> int i;
>
> for (i = 0; uev->envp[i] != NULL; i++) {
> - if (!strncmp(uev->envp[i], "DM_NAME", 6) &&
> - strlen(uev->envp[i]) > 7) {
> + if (!strncmp(uev->envp[i], "DM_NAME", 7) &&
> + strlen(uev->envp[i]) > 8) {
> p = MALLOC(strlen(uev->envp[i] + 8) + 1);
> strcpy(p, uev->envp[i] + 8);
> break;
Reviewed-by: Martin Wilck <mwilck at suse.com>
--
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
More information about the dm-devel
mailing list