projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cuserid: support invocation with a null pointer argument
[musl]
/
src
/
network
/
getservbyport_r.c
diff --git
a/src/network/getservbyport_r.c
b/src/network/getservbyport_r.c
index
0ae0e41
..
b7f21c6
100644
(file)
--- a/
src/network/getservbyport_r.c
+++ b/
src/network/getservbyport_r.c
@@
-5,6
+5,7
@@
#include <inttypes.h>
#include <errno.h>
#include <string.h>
#include <inttypes.h>
#include <errno.h>
#include <string.h>
+#include <stdlib.h>
int getservbyport_r(int port, const char *prots,
struct servent *se, char *buf, size_t buflen, struct servent **res)
int getservbyport_r(int port, const char *prots,
struct servent *se, char *buf, size_t buflen, struct servent **res)
@@
-51,6
+52,9
@@
int getservbyport_r(int port, const char *prots,
break;
}
break;
}
+ /* A numeric port string is not a service record. */
+ if (strtol(buf, 0, 10)==ntohs(port)) return ENOENT;
+
*res = se;
return 0;
}
*res = se;
return 0;
}