Guarantee NUL termination if hostname gets truncated.

Signed-off-by: Patrick Marchand Latifi <[EMAIL PROTECTED]>
---

 dapl/common/dapl_ia_open.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/dapl/common/dapl_ia_open.c b/dapl/common/dapl_ia_open.c
index cf15f61..3793048 100644
--- a/dapl/common/dapl_ia_open.c
+++ b/dapl/common/dapl_ia_open.c
@@ -395,6 +395,10 @@ dapli_assign_hca_ip_address (
      */
 
     rc = gethostname (hostname, NAMELEN);
+
+    /* guarantee NUL termination if hostname gets truncated */
+    hostname[NAMELEN-1] = '\0';
+
     /*
      * Strip off domain info if it exists (e.g. mynode.mydomain.com)
      */

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to