]> granicus.if.org Git - curl/commitdiff
RTSP: catch attempted unsupported requests better
authorDaniel Stenberg <daniel@haxx.se>
Fri, 22 May 2015 14:32:42 +0000 (16:32 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 22 May 2015 14:32:42 +0000 (16:32 +0200)
Replace use of assert with code that properly catches bad input at
run-time even in non-debug builds.

This flaw was sort of detected by Coverity CID 1299425 which claimed the
"case RTSPREQ_NONE" was dead code.

lib/rtsp.c

index b133e205ffd68db4c7325cf5bcd0f02e34569d60..c5ca7572384f236874d219f704eda94d4e16d077 100644 (file)
@@ -263,11 +263,10 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
    * Since all RTSP requests are included here, there is no need to
    * support custom requests like HTTP.
    **/
-  DEBUGASSERT((rtspreq > RTSPREQ_NONE && rtspreq < RTSPREQ_LAST));
   data->set.opt_no_body = TRUE; /* most requests don't contain a body */
   switch(rtspreq) {
-  case RTSPREQ_NONE:
-    failf(data, "Got invalid RTSP request: RTSPREQ_NONE");
+  default:
+    failf(data, "Got invalid RTSP request");
     return CURLE_BAD_FUNCTION_ARGUMENT;
   case RTSPREQ_OPTIONS:
     p_request = "OPTIONS";