[m-rev.] diff: fix C off-by-one error for interactive queries

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Apr 2 20:18:08 AEST 2003


Estimated hours taken: 4
Branches: main, release

trace/mercury_trace_internal.c:
	Fix off-by-one error (diagnosed using "valgrind").
	This bug caused a seg fault for tests/debugger/interactive
	in grade asm_fast.gc.tr.debug on mars.

Workspace: /home/ceres/fjh/mercury
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.149.2.1
diff -u -d -r1.149.2.1 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	22 Nov 2002 07:39:06 -0000	1.149.2.1
+++ trace/mercury_trace_internal.c	2 Apr 2003 10:15:57 -0000
@@ -2847,7 +2847,7 @@
 		strcat(MR_mmc_options, words[i]);
 		strcat(MR_mmc_options, " ");
 	}
-	MR_mmc_options[len] = '\0';
+	MR_mmc_options[len - 1] = '\0';
 
 	return KEEP_INTERACTING;
 }

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list