autofs/autofs-5.0.1-network_match-fix.patch
ikent f1ee4e6350 %changelog
Thu Mar 8 2007 Ian Kent <ikent@redhat.com> - 5.0.1-4
- fixed numeric export match (bz 231188).
2007-03-08 03:41:50 +00:00

32 lines
642 B
Diff

diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index 2c5b5d5..5151a1e 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -1072,18 +1072,23 @@ static char *inet_fill_net(const char *net_num, char *net)
if (strlen(net_num) > INET_ADDRSTRLEN)
return NULL;
+ if (!isdigit(*net_num))
+ return NULL;
+
*net = '\0';
strcpy(net, net_num);
np = net;
- while (*np) {
- if (*np++ == '.') {
+ while (*np++) {
+ if (*np == '.') {
+ np++;
dots--;
if (!*np && dots)
strcat(net, "0");
+ continue;
}
- if (!isdigit(*np) || dots < 0) {
+ if ((*np && !isdigit(*np)) || dots < 0) {
*net = '\0';
return NULL;
}