Skip to content

Commit 3576f0a

Browse files
committed
gnu.cfg: Added support for gethostbyaddr_r()
1 parent ea56359 commit 3576f0a

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

cfg/posix.cfg

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3970,6 +3970,46 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
39703970
<not-bool/>
39713971
</arg>
39723972
</function>
3973+
<!-- https://man7.org/linux/man-pages/man3/gethostbyaddr_r.3.html -->
3974+
<!-- int gethostbyaddr_r(const void *addr, socklen_t len, int type, struct hostent *restrict ret, char *restrict buf, size_t buflen, struct hostent **restrict result, int *restrict h_errnop); -->
3975+
<function name="gethostbyaddr_r">
3976+
<returnValue type="int"/>
3977+
<noreturn>false</noreturn>
3978+
<use-retval/>
3979+
<pure/>
3980+
<arg nr="1" direction="in">
3981+
<not-uninit/>
3982+
<not-null/>
3983+
</arg>
3984+
<arg nr="2" direction="in">
3985+
<not-uninit/>
3986+
<valid>0:</valid>
3987+
</arg>
3988+
<arg nr="3" direction="in">
3989+
<not-uninit/>
3990+
</arg>
3991+
<arg nr="4" direction="out">
3992+
<not-null/>
3993+
</arg>
3994+
<arg nr="5" direction="in">
3995+
<not-uninit/>
3996+
<not-null/>
3997+
<minsize type="argvalue" arg="6"/>
3998+
</arg>
3999+
<arg nr="6" direction="in">
4000+
<not-uninit/>
4001+
<valid>0:</valid>
4002+
</arg>
4003+
<arg nr="7" direction="in">
4004+
<not-null/>
4005+
<not-uninit/>
4006+
</arg>
4007+
<arg nr="8" direction="in">
4008+
<not-null/>
4009+
<not-uninit/>
4010+
</arg>
4011+
</function>
4012+
39734013
<!-- void setkey(const char *key); -->
39744014
<function name="setkey">
39754015
<noreturn>false</noreturn>

test/cfg/gnu.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ void unreachableCode_error(void) // #11197
3434
int i;
3535
}
3636

37+
int nullPointer_gethostbyaddr_r(const void* addr, socklen_t len, int type, struct hostent* ret, char* buf, size_t buflen, struct hostent** result, int* h_errnop)
38+
{
39+
// cppcheck-suppress nullPointer
40+
(void) gethostbyaddr_r(NULL, len, type, ret, buf, buflen, result, h_errnop);
41+
// cppcheck-suppress nullPointer
42+
(void) gethostbyaddr_r(addr, len, type, NULL, buf, buflen, result, h_errnop);
43+
// cppcheck-suppress nullPointer
44+
(void) gethostbyaddr_r(addr, len, type, ret, NULL, buflen, result, h_errnop);
45+
// cppcheck-suppress nullPointer
46+
(void) gethostbyaddr_r(addr, len, type, ret, buf, buflen, NULL, h_errnop);
47+
// cppcheck-suppress nullPointer
48+
(void) gethostbyaddr_r(addr, len, type, ret, buf, buflen, result, NULL);
49+
return gethostbyaddr_r(addr, len, type, ret, buf, buflen, result, h_errnop);
50+
}
51+
3752
int nullPointer_getopt_long(int argc, char **argv, const char *optstring,
3853
const struct option *longopts, int *longindex)
3954
{

0 commit comments

Comments
 (0)