Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Unterminated log buffer causes corrupt log messages
From: Kevin M. Hildebrand (kevin_at_[hidden])
Date: 2013-10-09 10:40:28


Hi, I just noticed a bug in the common logging code in both 1.6.5 and 1.7.2. For sites with hostnames longer than 32 characters, the terminating NULL is getting cut off the hostname string.

Here's a simple patch to fix:

diff -c -r1.1 opal/util/output.c
*** opal/util/output.c 2013/10/09 14:09:47 1.1
--- opal/util/output.c 2013/10/09 14:12:06
***************
*** 140,145 ****
--- 140,146 ----
      }
  #endif /* defined(__WINDOWS__) */
      gethostname(hostname, sizeof(hostname));
+ hostname[sizeof(hostname)-1] = '\0';
      verbose.lds_want_stderr = true;
      asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid());

Thanks!
Kevin

--
Kevin Hildebrand
University of Maryland, College Park
Division of IT