]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r316131:
authorngie <ngie@FreeBSD.org>
Sun, 28 May 2017 00:45:02 +0000 (00:45 +0000)
committerngie <ngie@FreeBSD.org>
Sun, 28 May 2017 00:45:02 +0000 (00:45 +0000)
commit4a550888a16640efaafa8a870de7e4994f8ba97e
tree112af57b3bf4c7804df5fe4df322e8a1e3505fea
parent890cd96dc364cf41ac92d0c457088b89c74dd7d1
MFC r316131:

Fix up r316081 by using nitems(cam_errbuf) instead of sizeof(cam_errbuf)

Part of my original reasoning as far as converting the snprintf
calls was to permit switching over from char[] to wchar_t[] in the
future, as well as futureproof in case cam_errbuf's size was ever
changed.

Unfortunately, my approach was bugged because it conflated the
number of items with the size of the buffer, instead of the number of
elements being a fixed size != 1 byte.

Use nitems(..) instead which counts the quantity of items of a specific
type, as opposed to an unqualified sizeof(..) (which assumes that the
number of characters is equal to the buffer size).

Noted by: cem
lib/libcam/camlib.c