]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
Guarantee NUL termination if hostname gets truncated.
authorPatrick Marchand Latifi <patrick.latifi@qlogic.com>
Tue, 19 Feb 2008 11:19:42 +0000 (03:19 -0800)
committerArlin Davis <arlin.r.davis@intel.com>
Thu, 28 Feb 2008 00:13:37 +0000 (16:13 -0800)
Signed-off-by: Patrick Marchand Latifi <patrick.latifi@qlogic.com>
dapl/common/dapl_ia_open.c

index a780a9825e056bcb1d41f30b6f7de7efbe194176..d85c1b6a26f459dfd888a8233ddeb85a5fdd618b 100644 (file)
@@ -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)
      */