Fix: Unchecked asprintf/vasprintf return values
A message that is not in the archive (sent off-list or not yet received): [email protected]
Merged!
Jérémie Galarneau:
Quoted 35 lines
strp·may·be·modified·even·in·case·of·failure·according·to·the ASPRINTF(3) man page.
Signed-off-by Jérémie Galarneau <[email protected]>--- tests/utils/tap/tap.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)tests/utils/tap/tap.c +6
-2@@ -83,7 +83,9 @@ _gen_result(int ok, const char *func, char *file, unsigned int line,expansions on it */ if (test_name !=NULL ) {va_start (ap, test_name); -vasprintf (&local_test_name, test_name, ap); +if (vasprintf (&local_test_name, test_name, ap) ==-1 ) { + local_test_name =NULL ; + }va_end (ap);/* Make sure the test name contains more than digits @@ -299,7 +301,9 @@ skip(unsigned int n, char *fmt, ...)LOCK ;va_start (ap, fmt); -asprintf (&skip_msg, fmt, ap); +if (asprintf (&skip_msg, fmt, ap) ==-1 ) { + skip_msg =NULL ; + }va_end (ap);while (n-- >0 ) {
tests/utils/tap/tap.c todo_start(char *fmt, ...) · line 336
Quoted 10 lines
tests/utils/tap/tap.c +3
-1@@ -324,7 +328,9 @@ todo_start(char *fmt, ...)LOCK ;va_start (ap, fmt); -vasprintf (&todo_msg, fmt, ap); +if (vasprintf (&todo_msg, fmt, ap) ==-1 ) { + todo_msg =NULL ; + }va_end (ap); todo =1 ;
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev