gnu.cfg: Added support for gethostbyaddr_r()

This commit is contained in:
orbitcowboy 2022-12-22 09:36:53 +01:00
parent ea56359a3f
commit 3576f0a0c7
2 changed files with 55 additions and 0 deletions

View File

@ -3970,6 +3970,46 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<not-bool/>
</arg>
</function>
<!-- https://man7.org/linux/man-pages/man3/gethostbyaddr_r.3.html -->
<!-- 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); -->
<function name="gethostbyaddr_r">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
</arg>
<arg nr="4" direction="out">
<not-null/>
</arg>
<arg nr="5" direction="in">
<not-uninit/>
<not-null/>
<minsize type="argvalue" arg="6"/>
</arg>
<arg nr="6" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="7" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="8" direction="in">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- void setkey(const char *key); -->
<function name="setkey">
<noreturn>false</noreturn>

View File

@ -34,6 +34,21 @@ void unreachableCode_error(void) // #11197
int i;
}
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)
{
// cppcheck-suppress nullPointer
(void) gethostbyaddr_r(NULL, len, type, ret, buf, buflen, result, h_errnop);
// cppcheck-suppress nullPointer
(void) gethostbyaddr_r(addr, len, type, NULL, buf, buflen, result, h_errnop);
// cppcheck-suppress nullPointer
(void) gethostbyaddr_r(addr, len, type, ret, NULL, buflen, result, h_errnop);
// cppcheck-suppress nullPointer
(void) gethostbyaddr_r(addr, len, type, ret, buf, buflen, NULL, h_errnop);
// cppcheck-suppress nullPointer
(void) gethostbyaddr_r(addr, len, type, ret, buf, buflen, result, NULL);
return gethostbyaddr_r(addr, len, type, ret, buf, buflen, result, h_errnop);
}
int nullPointer_getopt_long(int argc, char **argv, const char *optstring,
const struct option *longopts, int *longindex)
{