X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fnetwork%2Fproto.c;h=c4fd34efb0ad4883133573dc090b1b7692f5b012;hb=12590c8bbd04ea484cee86812e2258fbdfca0e59;hp=c569232f5a0ad9429948abc16fd5910c7dffcc86;hpb=eb375ef795a7e810a24d8b45c680be365a402a91;p=musl diff --git a/src/network/proto.c b/src/network/proto.c index c569232f..c4fd34ef 100644 --- a/src/network/proto.c +++ b/src/network/proto.c @@ -4,17 +4,43 @@ /* do we really need all these?? */ static int idx; -static const unsigned char protos[][6] = { - "\000ip", - "\001icmp", - "\002igmp", - "\003ggp", - "\006tcp", - "\014pup", - "\021udp", - "\026idp", - "\377raw", - "\0\0" +static const unsigned char protos[] = { + "\000ip\0" + "\001icmp\0" + "\002igmp\0" + "\003ggp\0" + "\004ipencap\0" + "\005st\0" + "\006tcp\0" + "\010egp\0" + "\014pup\0" + "\021udp\0" + "\024hmp\0" + "\026xns-idp\0" + "\033rdp\0" + "\035iso-tp4\0" + "\044xtp\0" + "\045ddp\0" + "\046idpr-cmtp\0" + "\051ipv6\0" + "\053ipv6-route\0" + "\054ipv6-frag\0" + "\055idrp\0" + "\056rsvp\0" + "\057gre\0" + "\062esp\0" + "\063ah\0" + "\071skip\0" + "\072ipv6-icmp\0" + "\073ipv6-nonxt\0" + "\074ipv6-opts\0" + "\111rspf\0" + "\121vmtp\0" + "\131ospf\0" + "\136ipip\0" + "\142encap\0" + "\147pim\0" + "\377raw" }; void endprotoent(void) @@ -31,10 +57,11 @@ struct protoent *getprotoent(void) { static struct protoent p; static const char *aliases; - if (!protos[idx][1]) return NULL; - p.p_proto = protos[idx][0]; - p.p_name = (char *)protos[idx++]+1; + if (idx >= sizeof protos) return NULL; + p.p_proto = protos[idx]; + p.p_name = (char *)&protos[idx+1]; p.p_aliases = (char **)&aliases; + idx += strlen(p.p_name) + 2; return &p; }