diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -7749,7 +7749,7 @@ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *pp, internal_strlen(*pp) + 1); COMMON_INTERCEPTOR_WRITE_RANGE(ctx, p->p_aliases, - pp_size * sizeof(char **)); + pp_size * sizeof(char *)); } INTERCEPTOR(struct __sanitizer_protoent *, getprotoent) { @@ -7856,7 +7856,7 @@ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *nn, internal_strlen(*nn) + 1); COMMON_INTERCEPTOR_WRITE_RANGE(ctx, n->n_aliases, - nn_size * sizeof(char **)); + nn_size * sizeof(char *)); } return n; } @@ -7878,7 +7878,7 @@ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *nn, internal_strlen(*nn) + 1); COMMON_INTERCEPTOR_WRITE_RANGE(ctx, n->n_aliases, - nn_size * sizeof(char **)); + nn_size * sizeof(char *)); } return n; } @@ -7898,7 +7898,7 @@ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *nn, internal_strlen(*nn) + 1); COMMON_INTERCEPTOR_WRITE_RANGE(ctx, n->n_aliases, - nn_size * sizeof(char **)); + nn_size * sizeof(char *)); } return n; } diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/netent.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/netent.cpp --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/netent.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/netent.cpp @@ -23,6 +23,11 @@ assert(ntp && ntp->n_name); assert(ntp->n_addrtype == 2); assert(ntp->n_net == 127); + char **aliases = ntp->n_aliases; + while (aliases) { + printf("%s\n", *aliases); + aliases++; + } endnetent(); } @@ -31,6 +36,11 @@ assert(ntp && ntp->n_name); assert(ntp->n_addrtype == 2); assert(ntp->n_net == 127); + char **aliases = ntp->n_aliases; + while (aliases) { + printf("%s\n", *aliases); + aliases++; + } endnetent(); } @@ -41,6 +51,11 @@ assert(ntp && ntp->n_name); assert(ntp->n_addrtype == 2); assert(ntp->n_net == 127); + char **aliases = ntp->n_aliases; + while (aliases) { + printf("%s\n", *aliases); + aliases++; + } endnetent(); } diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/protoent.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/protoent.cpp --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/protoent.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/protoent.cpp @@ -15,6 +15,11 @@ struct protoent *ptp = getprotoent(); assert(ptp && ptp->p_name); assert(ptp->p_proto == 0); + char **aliases = ptp->p_aliases; + while (aliases) { + printf("%s\n", *aliases); + aliases++; + } endprotoent(); } @@ -22,6 +27,11 @@ struct protoent *ptp = getprotobyname("tcp"); assert(ptp && ptp->p_name); assert(ptp->p_proto == 6); + char **aliases = ptp->p_aliases; + while (aliases) { + printf("%s\n", *aliases); + aliases++; + } endprotoent(); } @@ -29,6 +39,11 @@ struct protoent *ptp = getprotobynumber(1); assert(ptp && ptp->p_name); assert(ptp->p_proto == 1); + char **aliases = ptp->p_aliases; + while (aliases) { + printf("%s\n", *aliases); + aliases++; + } endprotoent(); }