[PATCH 06/12] s3-lib: Do not walk past the end of the dos_to_ntstatus_map array

abartlet at samba.org abartlet at samba.org
Sun Sep 7 17:30:32 MDT 2014


From: Andrew Bartlett <abartlet at samba.org>

Found by AddressSanitizer

Change-Id: Ic8b3e2599713c37b11324f9ec2d01891f0f287b9
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
 source3/libsmb/errormap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/libsmb/errormap.c b/source3/libsmb/errormap.c
index 22daee4..cc25c7e 100644
--- a/source3/libsmb/errormap.c
+++ b/source3/libsmb/errormap.c
@@ -285,7 +285,7 @@ NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode)
 {
 	int i;
 	if (eclass == 0) return NT_STATUS_OK;
-	for (i=0; NT_STATUS_V(dos_to_ntstatus_map[i].ntstatus); i++) {
+	for (i=0; i < ARRAY_SIZE(dos_to_ntstatus_map); i++) {
 		if (eclass == dos_to_ntstatus_map[i].dos_class &&
 		    ecode == dos_to_ntstatus_map[i].dos_code) {
 			return dos_to_ntstatus_map[i].ntstatus;
-- 
2.1.0



More information about the samba-technical mailing list