mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
Merge pull request #9903 from yuwata/fuzzer-10007
Fixes issue 10007 by oss-fuzz
This commit is contained in:
@@ -50,7 +50,8 @@ static const char* const socket_address_type_table[] = {
|
||||
DEFINE_STRING_TABLE_LOOKUP(socket_address_type, int);
|
||||
|
||||
int socket_address_parse(SocketAddress *a, const char *s) {
|
||||
char *e, *n;
|
||||
_cleanup_free_ char *n = NULL;
|
||||
char *e;
|
||||
int r;
|
||||
|
||||
assert(a);
|
||||
@@ -68,7 +69,9 @@ int socket_address_parse(SocketAddress *a, const char *s) {
|
||||
if (!e)
|
||||
return -EINVAL;
|
||||
|
||||
n = strndupa(s+1, e-s-1);
|
||||
n = strndup(s+1, e-s-1);
|
||||
if (!n)
|
||||
return -ENOMEM;
|
||||
|
||||
errno = 0;
|
||||
if (inet_pton(AF_INET6, n, &a->sockaddr.in6.sin6_addr) <= 0)
|
||||
@@ -125,7 +128,10 @@ int socket_address_parse(SocketAddress *a, const char *s) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
n = strndupa(cid_start, e - cid_start);
|
||||
n = strndup(cid_start, e - cid_start);
|
||||
if (!n)
|
||||
return -ENOMEM;
|
||||
|
||||
if (!isempty(n)) {
|
||||
r = safe_atou(n, &a->sockaddr.vm.svm_cid);
|
||||
if (r < 0)
|
||||
@@ -146,7 +152,9 @@ int socket_address_parse(SocketAddress *a, const char *s) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
n = strndupa(s, e-s);
|
||||
n = strndup(s, e-s);
|
||||
if (!n)
|
||||
return -ENOMEM;
|
||||
|
||||
/* IPv4 in w.x.y.z:p notation? */
|
||||
r = inet_pton(AF_INET, n, &a->sockaddr.in.sin_addr);
|
||||
|
||||
6
test/fuzz-regressions/fuzz-unit-file/oss-fuzz-10007
Normal file
6
test/fuzz-regressions/fuzz-unit-file/oss-fuzz-10007
Normal file
File diff suppressed because one or more lines are too long
@@ -31,4 +31,5 @@ fuzz_regression_tests = '''
|
||||
fuzz-unit-file/oss-fuzz-7004
|
||||
fuzz-unit-file/oss-fuzz-8064
|
||||
fuzz-unit-file/oss-fuzz-8827
|
||||
fuzz-unit-file/oss-fuzz-10007
|
||||
'''.split()
|
||||
|
||||
Reference in New Issue
Block a user