* [PATCH 1/1] ibacm: define prov_lib_path as a char array
@ 2014-07-02 18:30 kaike.wan-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1404325850-918-1-git-send-email-kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: kaike.wan-ral2JQCrhuEAvxtiuMwx3w @ 2014-07-02 18:30 UTC (permalink / raw)
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Kaike Wan
From: Kaike Wan <kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
This patch fixes a segfault error when the option file defines the provider
lib path. The variable prov_lib_path should be a buffer (char array) instead
of a char pointer. This allows a string to be copied into it during option
parsing.
Signed-off-by: Kaike Wan <kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
src/acm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/acm.c b/src/acm.c
index 8f147ef..fae9d0b 100644
--- a/src/acm.c
+++ b/src/acm.c
@@ -193,7 +193,7 @@ static int log_level = 0;
static char lock_file[128] = "/var/run/ibacm.pid";
static short server_port = 6125;
static int support_ips_in_addr_cfg = 0;
-static char *prov_lib_path = IBACM_LIB_PATH;
+static char prov_lib_path[256] = IBACM_LIB_PATH;
void acm_write(int level, const char *format, ...)
{
--
1.7.1
--
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] 5+ messages in thread
* RE: [PATCH 1/1] ibacm: define prov_lib_path as a char array
[not found] ` <1404325850-918-1-git-send-email-kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2014-07-02 20:22 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E04BD17C0-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Weiny, Ira @ 2014-07-02 20:22 UTC (permalink / raw)
To: Hefty, Sean
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Wan, Kaike
>
> diff --git a/src/acm.c b/src/acm.c
> index 8f147ef..fae9d0b 100644
> --- a/src/acm.c
> +++ b/src/acm.c
> @@ -193,7 +193,7 @@ static int log_level = 0; static char lock_file[128] =
> "/var/run/ibacm.pid"; static short server_port = 6125; static int
> support_ips_in_addr_cfg = 0; -static char *prov_lib_path = IBACM_LIB_PATH;
> +static char prov_lib_path[256] = IBACM_LIB_PATH;
256 is too short for a path. Typical is 4096 but would be nice if it were dynamic.
Ira
--
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] 5+ messages in thread
* RE: [PATCH 1/1] ibacm: define prov_lib_path as a char array
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E04BD17C0-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2014-07-02 20:25 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E04BD180B-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Weiny, Ira @ 2014-07-02 20:25 UTC (permalink / raw)
To: Weiny, Ira, Hefty, Sean
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Wan, Kaike
> >
> > diff --git a/src/acm.c b/src/acm.c
> > index 8f147ef..fae9d0b 100644
> > --- a/src/acm.c
> > +++ b/src/acm.c
> > @@ -193,7 +193,7 @@ static int log_level = 0; static char
> > lock_file[128] = "/var/run/ibacm.pid"; static short server_port =
> > 6125; static int support_ips_in_addr_cfg = 0; -static char
> > *prov_lib_path = IBACM_LIB_PATH;
> > +static char prov_lib_path[256] = IBACM_LIB_PATH;
>
> 256 is too short for a path. Typical is 4096 but would be nice if it were
> dynamic.
Oh and do you need the length as a #define somewhere to prevent overflowing the buffer when reading from the config file?
Ira
--
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] 5+ messages in thread
* RE: [PATCH 1/1] ibacm: define prov_lib_path as a char array
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E04BD180B-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2014-07-02 20:39 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A8237399324746-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Hefty, Sean @ 2014-07-02 20:39 UTC (permalink / raw)
To: Weiny, Ira; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Wan, Kaike
> > > diff --git a/src/acm.c b/src/acm.c
> > > index 8f147ef..fae9d0b 100644
> > > --- a/src/acm.c
> > > +++ b/src/acm.c
> > > @@ -193,7 +193,7 @@ static int log_level = 0; static char
> > > lock_file[128] = "/var/run/ibacm.pid"; static short server_port =
> > > 6125; static int support_ips_in_addr_cfg = 0; -static char
> > > *prov_lib_path = IBACM_LIB_PATH;
> > > +static char prov_lib_path[256] = IBACM_LIB_PATH;
> >
> > 256 is too short for a path. Typical is 4096 but would be nice if it
> were
> > dynamic.
>
> Oh and do you need the length as a #define somewhere to prevent overflowing
> the buffer when reading from the config file?
The code only reads in values from the config file that are up to 256 bytes long. Have you seen paths longer than 256 in practice?
--
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] 5+ messages in thread
* RE: [PATCH 1/1] ibacm: define prov_lib_path as a char array
[not found] ` <1828884A29C6694DAF28B7E6B8A8237399324746-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2014-07-02 20:44 ` Weiny, Ira
0 siblings, 0 replies; 5+ messages in thread
From: Weiny, Ira @ 2014-07-02 20:44 UTC (permalink / raw)
To: Hefty, Sean
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Wan, Kaike
> > > > diff --git a/src/acm.c b/src/acm.c index 8f147ef..fae9d0b 100644
> > > > --- a/src/acm.c
> > > > +++ b/src/acm.c
> > > > @@ -193,7 +193,7 @@ static int log_level = 0; static char
> > > > lock_file[128] = "/var/run/ibacm.pid"; static short server_port =
> > > > 6125; static int support_ips_in_addr_cfg = 0; -static char
> > > > *prov_lib_path = IBACM_LIB_PATH;
> > > > +static char prov_lib_path[256] = IBACM_LIB_PATH;
> > >
> > > 256 is too short for a path. Typical is 4096 but would be nice if
> > > it
> > were
> > > dynamic.
> >
> > Oh and do you need the length as a #define somewhere to prevent
> > overflowing the buffer when reading from the config file?
>
> The code only reads in values from the config file that are up to 256 bytes long.
> Have you seen paths longer than 256 in practice?
In an official install perhaps not. But I build in my home directory all the time. ;-)
Even if the config file parser is limiting to 256 I don't think it would be an issue to make this buffer larger. We can expand the config file parsing later if needed.
Ira
--
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] 5+ messages in thread
end of thread, other threads:[~2014-07-02 20:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-02 18:30 [PATCH 1/1] ibacm: define prov_lib_path as a char array kaike.wan-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1404325850-918-1-git-send-email-kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-07-02 20:22 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E04BD17C0-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-07-02 20:25 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E04BD180B-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-07-02 20:39 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A8237399324746-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-07-02 20:44 ` Weiny, Ira
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox