From 7c52a0ce17430e4702871545f00a89d4426328c6 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 19 Jul 2007 12:28:43 +0000 Subject: [PATCH] Help track down when NULL is passed to %s for OPAL replacements of asprintf and friends. This is not a failsafe; there are many cases where this check will not be used. But at least it's something... This commit was SVN r15500. --- opal/util/printf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/opal/util/printf.c b/opal/util/printf.c index 9892d7817b..26ca3a86d2 100644 --- a/opal/util/printf.c +++ b/opal/util/printf.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2007 Cisco, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,6 +24,7 @@ #include "opal_config.h" #include "opal/util/printf.h" +#include "opal/util/output.h" #include #include @@ -65,10 +67,14 @@ static int guess_strlen(const char *fmt, va_list ap) /* If there's an arg, get the strlen, otherwise we'll * use (null) */ - if (NULL != sarg) + if (NULL != sarg) { len += (int)strlen(sarg); - else + } else { +#if OMPI_ENABLE_DEBUG + opal_output(0, "OPAL DEBUG WARNING: Got a NULL argument to opal_vasprintf %s!\n"); +#endif len += 5; + } break; case 'd':