gnu.cfg: Added support for getservent_r().

This commit is contained in:
orbitcowboy 2022-05-03 11:53:36 +02:00
parent 3edb10a006
commit e293b66ac6
2 changed files with 36 additions and 0 deletions

View File

@ -727,6 +727,30 @@
<not-bool/> <not-bool/>
</arg> </arg>
</function> </function>
<!-- https://man7.org/linux/man-pages/man3/getservent_r.3.html -->
<!-- int getservent_r(struct servent *restrict result_buf, char *restrict buf, size_t buflen, struct servent **restrict result); -->
<function name="getservent_r">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<pure/>
<arg nr="1" direction="out">
<not-null/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<not-null/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- https://linux.die.net/man/3/ecvt_r --> <!-- https://linux.die.net/man/3/ecvt_r -->
<!-- int ecvt_r (double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); --> <!-- int ecvt_r (double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); -->
<function name="ecvt_r"> <function name="ecvt_r">

View File

@ -23,6 +23,18 @@
#endif #endif
#include <strings.h> #include <strings.h>
int nullPointer_getservent_r(struct servent *restrict result_buf, char *restrict buf, size_t buflen, struct servent **restrict result)
{
// cppcheck-suppress nullPointer
(void) getservent_r(NULL, buf, buflen, result);
// cppcheck-suppress nullPointer
(void) getservent_r(result_buf, NULL, buflen, result);
// cppcheck-suppress nullPointer
(void) getservent_r(result_buf, buf, buflen, NULL);
return getservent_r(result_buf, buf, buflen, result);
}
void *bufferAccessOutOfBounds_memrchr(const void *s, int c, size_t n) void *bufferAccessOutOfBounds_memrchr(const void *s, int c, size_t n)
{ {
char buf[42]={0}; char buf[42]={0};