diff --git a/main/http.c b/main/http.c
index ca2fe5df986a587f1b43ec9576acbbbaa05387ad..dc8814b552de2e76d1b9ca797702bb64c1912736 100644
--- a/main/http.c
+++ b/main/http.c
@@ -186,7 +186,7 @@ static struct ast_str *static_callback(struct ast_tcptls_session_instance *ser,
 	mtype = ftype2mtype(ftype, wkspace, sizeof(wkspace));
 	
 	/* Cap maximum length */
-	if ((len = strlen(uri) + strlen(ast_config_AST_DATA_DIR) + strlen("/static-http/") + 5)) {
+	if ((len = strlen(uri) + strlen(ast_config_AST_DATA_DIR) + strlen("/static-http/") + 5) > 1024) {
 		goto out403;
 	}