[asterisk-commits] russell: trunk r101819 - in /trunk: ./ apps/app_authenticate.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 1 11:26:31 CST 2008


Author: russell
Date: Fri Feb  1 11:26:31 2008
New Revision: 101819

URL: http://svn.digium.com/view/asterisk?view=rev&rev=101819
Log:
Merged revisions 101818 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r101818 | russell | 2008-02-01 11:23:47 -0600 (Fri, 01 Feb 2008) | 4 lines

Don't overwrite the last character of a line if it's not a newline.  This would
happen if the last line in the file doesn't have a newline.
(pointed out by Qwell)

........

Modified:
    trunk/   (props changed)
    trunk/apps/app_authenticate.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_authenticate.c?view=diff&rev=101819&r1=101818&r2=101819
==============================================================================
--- trunk/apps/app_authenticate.c (original)
+++ trunk/apps/app_authenticate.c Fri Feb  1 11:26:31 2008
@@ -148,6 +148,8 @@
 			}
 
 			for (;;) {
+				size_t len;
+
 				fgets(buf, sizeof(buf), f);
 
 				if (feof(f))
@@ -156,7 +158,9 @@
 				if (ast_strlen_zero(buf))
 					continue;
 
-				buf[strlen(buf) - 1] = '\0';
+				len = strlen(buf) - 1;
+				if (buf[len - 1] = '\n')
+					buf[len - 1] = '\0';
 
 				if (ast_test_flag(&flags, OPT_MULTIPLE)) {
 					md5secret = buf;




More information about the asterisk-commits mailing list