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.
Этот коммит содержится в:
родитель
9b14008f61
Коммит
7c52a0ce17
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -23,6 +24,7 @@
|
|||||||
#include "opal_config.h"
|
#include "opal_config.h"
|
||||||
|
|
||||||
#include "opal/util/printf.h"
|
#include "opal/util/printf.h"
|
||||||
|
#include "opal/util/output.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -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
|
/* If there's an arg, get the strlen, otherwise we'll
|
||||||
* use (null) */
|
* use (null) */
|
||||||
|
|
||||||
if (NULL != sarg)
|
if (NULL != sarg) {
|
||||||
len += (int)strlen(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;
|
len += 5;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user