DragonFly BSD
DragonFly hammer List (threaded) for 2010-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

hammer_vop_nresolve() off-by-one?


From: Daniel Lorch <dlorch@xxxxxxxxx>
Date: Mon, 05 Apr 2010 18:58:29 +0200

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);



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]