FreeBSD Bugzilla – Attachment 153194 Details for
Bug 26486
[libc] [patch] setnetgrent hangs when netgroup contains empty netgroup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated patch to solve hang on empty netgroups for FreeBSD 10
getnetgrent.c.patch (text/plain), 1.38 KB, created by
gil
on 2015-02-19 21:39:02 UTC
(
hide
)
Description:
Updated patch to solve hang on empty netgroups for FreeBSD 10
Filename:
MIME Type:
Creator:
gil
Created:
2015-02-19 21:39:02 UTC
Size:
1.38 KB
patch
obsolete
>--- /usr/src/lib/libc/gen/getnetgrent.c.ORIG 2014-11-11 14:02:33.000000000 -0600 >+++ /usr/src/lib/libc/gen/getnetgrent.c 2015-02-19 15:23:05.000000000 -0600 >@@ -583,18 +583,18 @@ > len = pos - spos; > while (*pos == ' ' || *pos == '\t') > pos++; >+ lp = (struct linelist *)malloc(sizeof (*lp)); >+ if (lp == NULL) >+ return (NULL); >+ lp->l_parsed = 0; >+ lp->l_groupname = (char *)malloc(len + 1); >+ if (lp->l_groupname == NULL) { >+ free(lp); >+ return (NULL); >+ } >+ bcopy(spos, lp->l_groupname, len); >+ *(lp->l_groupname + len) = 0; > if (*pos != '\n' && *pos != '\0') { >- lp = (struct linelist *)malloc(sizeof (*lp)); >- if (lp == NULL) >- return (NULL); >- lp->l_parsed = 0; >- lp->l_groupname = (char *)malloc(len + 1); >- if (lp->l_groupname == NULL) { >- free(lp); >- return (NULL); >- } >- bcopy(spos, lp->l_groupname, len); >- *(lp->l_groupname + len) = '\0'; > len = strlen(pos); > olen = 0; > >@@ -633,16 +633,17 @@ > cont = 0; > } > } while (cont); >- lp->l_line = linep; >- lp->l_next = linehead; >- linehead = lp; >- >- /* >- * If this is the one we wanted, we are done. >- */ >- if (!strcmp(lp->l_groupname, group)) >- return (lp); > } >+ >+ lp->l_line = linep; >+ lp->l_next = linehead; >+ linehead = lp; >+ >+ /* >+ * If this is the one we wanted, we are done. >+ */ >+ if (!strcmp(lp->l_groupname, group)) >+ return (lp); > } > #ifdef YP > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 26486
: 153194