All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] osmtest: Make the "-guid" option's argument mandatory
@ 2013-06-28  8:07 Roland Dreier
       [not found] ` <1372406820-11505-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Dreier @ 2013-06-28  8:07 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

From: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>

Currently, the getopt table in osmtest labels the "-guid" option as
taking an optional argument; however, running osmtest with the -guid
option but no argument just leads to:

    $ /usr/sbin/osmtest -guid

    Command Line Arguments
    Segmentation fault

because the handling for the -guid option just passes optarg directly to
strtoull(), and without and argument, optarg is NULL.  Really, the
argument should be mandatory.

This bug was found by the Mayhem tool:
http://www.forallsecure.com/bug-reports/edea01ceefbb188dcc62b3fc4f59dc743d7429c9/

Signed-off-by: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
---
 osmtest/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/osmtest/main.c b/osmtest/main.c
index 6129674..f48910b 100644
--- a/osmtest/main.c
+++ b/osmtest/main.c
@@ -293,7 +293,7 @@ int main(int argc, char *argv[])
 		{"wait", 1, NULL, 'w'},
 		{"inventory", 1, NULL, 'i'},
 		{"max_lid", 1, NULL, 'm'},
-		{"guid", 2, NULL, 'g'},
+		{"guid", 1, NULL, 'g'},
 		{"port", 0, NULL, 'p'},
 		{"help", 0, NULL, 'h'},
 		{"stress", 1, NULL, 's'},
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] osmtest: Make the "-guid" option's argument mandatory
       [not found] ` <1372406820-11505-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2013-06-29 13:19   ` Hal Rosenstock
  0 siblings, 0 replies; 2+ messages in thread
From: Hal Rosenstock @ 2013-06-29 13:19 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 6/28/2013 4:07 AM, Roland Dreier wrote:
> From: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
> 
> Currently, the getopt table in osmtest labels the "-guid" option as
> taking an optional argument; however, running osmtest with the -guid
> option but no argument just leads to:
> 
>     $ /usr/sbin/osmtest -guid
> 
>     Command Line Arguments
>     Segmentation fault
> 
> because the handling for the -guid option just passes optarg directly to
> strtoull(), and without and argument, optarg is NULL.  Really, the
> argument should be mandatory.
> 
> This bug was found by the Mayhem tool:
> http://www.forallsecure.com/bug-reports/edea01ceefbb188dcc62b3fc4f59dc743d7429c9/
> 
> Signed-off-by: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>

Thanks. Applied.

-- Hal
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-29 13:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28  8:07 [PATCH] osmtest: Make the "-guid" option's argument mandatory Roland Dreier
     [not found] ` <1372406820-11505-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-06-29 13:19   ` Hal Rosenstock

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.