瀏覽代碼

modules/sanity: Fail if request uri can't be parsed

Alex Hermann 13 年之前
父節點
當前提交
dfe3f66fc7
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      modules/sanity/sanity.c

+ 7 - 0
modules/sanity/sanity.c

@@ -241,6 +241,13 @@ int check_ruri_scheme(struct sip_msg* _msg) {
 		/* unsupported schemes end up here already */
 		/* unsupported schemes end up here already */
 		LM_WARN("failed to parse request uri [%.*s]\n",
 		LM_WARN("failed to parse request uri [%.*s]\n",
 				GET_RURI(_msg)->len, GET_RURI(_msg)->s);
 				GET_RURI(_msg)->len, GET_RURI(_msg)->s);
+		if (_msg->REQ_METHOD != METHOD_ACK) {
+			if (slb.zreply(_msg, 400, "Bad Request URI") < 0) {
+				LOG(L_WARN, "sanity_check(): check_parse_uris():"
+						" failed to send 400 via sl reply (bad ruri)\n");
+			}
+		}
+		return SANITY_CHECK_FAILED;
 	}
 	}
 	if (_msg->parsed_uri.type == ERROR_URI_T) {
 	if (_msg->parsed_uri.type == ERROR_URI_T) {
 		if (_msg->REQ_METHOD != METHOD_ACK) {
 		if (_msg->REQ_METHOD != METHOD_ACK) {