Skip to content

Commit 7737a44

Browse files
committed
Fix #9345 FP wrongPrintfScanfArgNum for vasprintf
Configuration "<formatstr/>" for function is wrong, for the argument it is fine.
1 parent 32eb6e1 commit 7737a44

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

cfg/gnu.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,13 @@
351351
<arg nr="1" direction="out">
352352
<not-null/>
353353
</arg>
354-
<formatstr/>
355354
<arg nr="2" direction="in">
356355
<formatstr/>
357356
<not-uninit/>
358357
</arg>
359-
<arg nr="3">
358+
<arg nr="3" direction="in">
360359
<not-uninit/>
360+
<not-bool/>
361361
</arg>
362362
</function>
363363
<!-- http://man7.org/linux/man-pages/man2/accept.2.html -->

test/cfg/gnu.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <stdlib.h>
1212
#include <stdint.h>
1313
#include <stdio.h>
14+
#include <stdarg.h>
1415
#include <sys/time.h>
1516
#ifndef __CYGWIN__
1617
#include <sys/epoll.h>
@@ -87,7 +88,7 @@ int no_resourceLeak_mkostemp_02(char *template, int flags)
8788
return mkostemp(template, flags);
8889
}
8990

90-
void valid_code(int argInt1)
91+
void valid_code(int argInt1, va_list valist_arg)
9192
{
9293
char *p;
9394

@@ -111,6 +112,11 @@ void valid_code(int argInt1)
111112
__builtin_prefetch(p, 0, 1);
112113

113114
if (__builtin_types_compatible_p(int, char)) {}
115+
116+
char * pStr = NULL;
117+
if (vasprintf(&pStr, "%d %d", valist_arg) != -1) {
118+
free(pStr);
119+
}
114120
}
115121

116122
void ignoreleak(void)

0 commit comments

Comments
 (0)