hammer_vop_nresolve() off-by-one?

Daniel Lorch dlorch at gmail.com
Mon Apr 5 09:58:29 PDT 2010


Hello,

I was studying hammer_vop_nresolve() and in the loop for the @@
expansion, there seems to be an off-by-one error. A filename ending in
'@' would trigger the error. What do you think?

Daniel

--- hammer_vnops.c-dist	2010-04-05 18:51:56.000000000 +0200
+++ hammer_vnops.c	2010-04-05 18:52:25.000000000 +0200
@@ -811,7 +811,7 @@
 	hammer_simple_transaction(&trans, dip->hmp);
 	++hammer_stats_file_iopsr;

-	for (i = 0; i < nlen; ++i) {
+	for (i = 0; i < nlen-1 ; ++i) {
 		if (ncp->nc_name[i] == '@' && ncp->nc_name[i+1] == '@') {
 			error = hammer_str_to_tid(ncp->nc_name + i + 2,
 						  &ispfs, &asof, &localization);





More information about the Hammer mailing list