Try to protect libibverbs from hand modified configuration files.

Signed-off-by: Yann Droneaud <[email protected]>
---
 src/init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/init.c b/src/init.c
index c880b68..1981da7 100644
--- a/src/init.c
+++ b/src/init.c
@@ -311,6 +311,9 @@ static void read_config(void)
                if (dent->d_name[0] == '.')
                        continue;
 
+               if (dent->d_name[0] == '\0' || 
dent->d_name[strlen(dent->d_name) - 1] == '~')
+                       continue;
+
                if (asprintf(&path, "%s/%s", IBV_CONFIG_DIR, dent->d_name) < 0) 
{
                        fprintf(stderr, PFX "Warning: couldn't read config file 
%s/%s.\n",
                                IBV_CONFIG_DIR, dent->d_name);
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to