diff --git a/res/res_adsi.c b/res/res_adsi.c
index 30d8cfc851387e1f6d4a2fd8aa6264cab0b8beab..c4380bf59c3b4772b91c6fe83aedd6d078ca656a 100644
--- a/res/res_adsi.c
+++ b/res/res_adsi.c
@@ -593,7 +593,7 @@ int AST_OPTIONAL_API_NAME(ast_adsi_read_encoded_dtmf)(struct ast_channel *chan,
 	int bytes = 0, res, gotstar = 0, pos = 0;
 	unsigned char current = 0;
 
-	memset(buf, 0, sizeof(buf));
+	memset(buf, 0, maxlen);
 
 	while (bytes <= maxlen) {
 		/* Wait up to a second for a digit */