PERFORCE change 144040 for review

Gabor Kovesdan gabor at FreeBSD.org
Tue Jun 24 19:29:30 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=144040

Change 144040 by gabor at gabor_server on 2008/06/24 19:28:52

	- Don't forget to check if mbstowcs() succeeds
	
	Reported by:	tkientzle

Affected files ...

.. //depot/projects/soc2008/gabor_textproc/grep/binary.c#11 edit

Differences ...

==== //depot/projects/soc2008/gabor_textproc/grep/binary.c#11 (text+ko) ====

@@ -79,7 +79,8 @@
 
 	wbuf = grep_malloc((s + 1) * sizeof(wchar_t));
 
-	mbstowcs(wbuf, f->base, s);
+	if (mbstowcs(wbuf, f->base, s) == -1)
+		return (0);
 
 	/* XXX knows too much about mmf internals */
 	for (i = 0; i < BUFSIZ && i < f->len; i++)


More information about the p4-projects mailing list