[Namazu-cvs 738] r207 - Search-Namazu/trunk

cvsd @ vaj.namazu.org cvsd @ vaj.namazu.org
2006年 3月 16日 (木) 14:01:09 JST


Author: knok
Date: 2006-03-16 14:01:08 +0900 (Thu, 16 Mar 2006)
New Revision: 207

Modified:
   Search-Namazu/trunk/ChangeLog
   Search-Namazu/trunk/Namazu.xs
Log:
Fixed wrong array access bug.


Modified: Search-Namazu/trunk/ChangeLog
===================================================================
--- Search-Namazu/trunk/ChangeLog	2006-03-14 09:20:34 UTC (rev 206)
+++ Search-Namazu/trunk/ChangeLog	2006-03-16 05:01:08 UTC (rev 207)
@@ -1,3 +1,8 @@
+2006-03-16  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
+
+	* Namazu.xs: Fixed wrong array access.
+	  Reported by Tadamasa Teranishi, thanks.
+
 2006-03-14  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
 
 	* Namazu.{xs,pm} : Added size attribute.

Modified: Search-Namazu/trunk/Namazu.xs
===================================================================
--- Search-Namazu/trunk/Namazu.xs	2006-03-14 09:20:34 UTC (rev 206)
+++ Search-Namazu/trunk/Namazu.xs	2006-03-16 05:01:08 UTC (rev 207)
@@ -54,6 +54,8 @@
 #define PL_sv_undef sv_undef
 #endif
 
+#define SEARCH_NAMAZU_FIELDS 5
+
 MODULE = Search::Namazu		PACKAGE = Search::Namazu
 
 PROTOTYPES: DISABLE
@@ -68,7 +70,7 @@
 		int i;
 		AV *retar;
 		NmzResult hlist;
-		char result[5][BUFSIZE];
+		char result[SEARCH_NAMAZU_FIELDS][BUFSIZE];
 
 		qstr = SvPV(query, PL_na);
 		nmz_codeconv_query(qstr);
@@ -82,7 +84,7 @@
 			nmz_get_field_data(hlist.data[i].idxid, hlist.data[i].docid, "summary", result[1]);
 			nmz_get_field_data(hlist.data[i].idxid, hlist.data[i].docid, "title", result[2]);
 			nmz_get_field_data(hlist.data[i].idxid, hlist.data[i].docid, "author", result[3]);
-			nmz_get_field_data(hlist.data[i].idxid, hlist.data[i].docid, "size", result[5]);
+			nmz_get_field_data(hlist.data[i].idxid, hlist.data[i].docid, "size", result[4]);
 			ENTER;
 			SAVETMPS;
 			PUSHMARK(SP);
@@ -94,7 +96,7 @@
 			PUSHs(sv_2mortal(newSVpv(result[1], strlen(result[1]))));
 			PUSHs(sv_2mortal(newSVpv(result[2], strlen(result[2]))));
 			PUSHs(sv_2mortal(newSVpv(result[3], strlen(result[3]))));
-			PUSHs(sv_2mortal(newSVpv(result[3], strlen(result[4]))));
+			PUSHs(sv_2mortal(newSVpv(result[4], strlen(result[4]))));
 			PUTBACK;
 			perl_call_method("set", G_DISCARD);
 			av_push(retar, ohlist);




Namazu-cvs メーリングリストの案内