From owner-svn-src-head@FreeBSD.ORG Thu Apr 12 11:23:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FF571065678; Thu, 12 Apr 2012 11:23:25 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5D668FC15; Thu, 12 Apr 2012 11:23:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3CBNOQs026193; Thu, 12 Apr 2012 11:23:24 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3CBNOB8026191; Thu, 12 Apr 2012 11:23:24 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201204121123.q3CBNOB8026191@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 12 Apr 2012 11:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234173 - head/contrib/openpam/lib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Apr 2012 11:23:25 -0000 Author: des Date: Thu Apr 12 11:23:24 2012 New Revision: 234173 URL: http://svn.freebsd.org/changeset/base/234173 Log: Keep a copy of the original pointer returned by openpam_readline() so we can free it later, instead of trying to free a pointer that points to the end of the buffer. Committed to head because this code no longer exists upstream. Submitted by: jasone@ Modified: head/contrib/openpam/lib/openpam_configure.c Modified: head/contrib/openpam/lib/openpam_configure.c ============================================================================== --- head/contrib/openpam/lib/openpam_configure.c Thu Apr 12 10:48:43 2012 (r234172) +++ head/contrib/openpam/lib/openpam_configure.c Thu Apr 12 11:23:24 2012 (r234173) @@ -360,7 +360,7 @@ openpam_parse_chain(pam_handle_t *pamh, pam_chain_t *this, **next; pam_facility_t fclt; pam_control_t ctlf; - char *line, *str, *name; + char *line0, *line, *str, *name; char *option, **optv; int len, lineno, ret; FILE *f; @@ -377,18 +377,18 @@ openpam_parse_chain(pam_handle_t *pamh, this = NULL; name = NULL; lineno = 0; - while ((line = openpam_readline(f, &lineno, NULL)) != NULL) { + while ((line0 = line = openpam_readline(f, &lineno, NULL)) != NULL) { /* get service name if necessary */ if (style == pam_conf_style) { if ((len = parse_service_name(&line, &str)) == 0) { openpam_log(PAM_LOG_NOTICE, "%s(%d): invalid service name (ignored)", filename, lineno); - FREE(line); + FREE(line0); continue; } if (strlcmp(service, str, len) != 0) { - FREE(line); + FREE(line0); continue; } } @@ -401,7 +401,7 @@ openpam_parse_chain(pam_handle_t *pamh, goto fail; } if (facility != fclt && facility != PAM_FACILITY_ANY) { - FREE(line); + FREE(line0); continue; } @@ -425,7 +425,7 @@ openpam_parse_chain(pam_handle_t *pamh, FREE(name); if (ret != PAM_SUCCESS) goto fail; - FREE(line); + FREE(line0); continue; } @@ -486,7 +486,7 @@ openpam_parse_chain(pam_handle_t *pamh, this = NULL; /* next please... */ - FREE(line); + FREE(line0); } if (!feof(f)) goto syserr;