lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r464351 - /lucene/lucy/trunk/charmonizer/metaquote/metaquote.c
Date Mon, 16 Oct 2006 01:14:42 GMT
Author: marvin
Date: Sun Oct 15 18:14:41 2006
New Revision: 464351

URL: http://svn.apache.org/viewvc?view=rev&rev=464351
Log:
Have metaquote null-terminate some strings, plus trivial commenting.

Modified:
    lucene/lucy/trunk/charmonizer/metaquote/metaquote.c

Modified: lucene/lucy/trunk/charmonizer/metaquote/metaquote.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/metaquote/metaquote.c?view=diff&rev=464351&r1=464350&r2=464351
==============================================================================
--- lucene/lucy/trunk/charmonizer/metaquote/metaquote.c (original)
+++ lucene/lucy/trunk/charmonizer/metaquote/metaquote.c Sun Oct 15 18:14:41 2006
@@ -42,8 +42,9 @@
     Check_IO_Op( fseek(in_fh, 0, SEEK_SET) );
 
     /* slurp input file and metaquote the contents */
-    source = (char*)malloc(source_len * sizeof(char));
+    source = (char*)malloc(source_len * sizeof(char) + 1);
     Check_IO_Op( fread(source, sizeof(char), source_len, in_fh) );
+    source[source_len] = '\0';
     dest = metaquote(source, source_len, &dest_len);
     
     /* blast out the metaquoted text */
@@ -128,6 +129,10 @@
         }
     }
 
+    /* null-terminate */
+    *dest = '\0';
+
+    /* store length in passed-in pointer */
     *dest_len = dest - dest_start;
 
     return dest_start;



Mime
View raw message