[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r12612: cleanups while i was trying to figure out how it worked (tor/trunk/src/common)



Author: arma
Date: 2007-11-30 12:23:46 -0500 (Fri, 30 Nov 2007)
New Revision: 12612

Modified:
   tor/trunk/src/common/util.c
Log:
cleanups while i was trying to figure out how it worked


Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c	2007-11-30 07:49:49 UTC (rev 12611)
+++ tor/trunk/src/common/util.c	2007-11-30 17:23:46 UTC (rev 12612)
@@ -1889,8 +1889,8 @@
  * the start of the next line.  If we run out of data, return a pointer to the
  * end of the string.  If we encounter an error, return NULL.
  *
- * NOTE: We modify <b>line</b> as we parse it, by inserting NULs to terminate
- * the key and value.
+ * NOTE: We modify *<b>line</b> as we parse it, by inserting NULs
+ * to terminate the key and value.
  */
 char *
 parse_line_from_str(char *line, char **key_out, char **value_out)
@@ -1923,9 +1923,10 @@
   while (*line && !TOR_ISSPACE(*line) && *line != '#')
     ++line;
 
-  /* Skip until the value */
+  /* Skip until the value, writing nuls so key will be nul-terminated */
   while (*line == ' ' || *line == '\t')
     *line++ = '\0';
+
   val = line;
 
   /* Find the end of the line. */