From: Daniel Stenberg Date: Fri, 24 Feb 2023 16:31:43 +0000 (+0100) Subject: rtsp: avoid sscanf for parsing X-Git-Tag: curl-8_0_0~149 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b15ee1e349b8bbf01d0d3b940bb4e1e0005c1d1;p=thirdparty%2Fcurl.git rtsp: avoid sscanf for parsing Closes #10605 --- diff --git a/lib/rtsp.c b/lib/rtsp.c index 9d27929e84..8e37fee381 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -755,12 +755,14 @@ CURLcode rtp_client_write(struct Curl_easy *data, char *ptr, size_t len) CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, char *header) { - long CSeq = 0; - if(checkprefix("CSeq:", header)) { - /* Store the received CSeq. Match is verified in rtsp_done */ - int nc = sscanf(&header[4], ": %ld", &CSeq); - if(nc == 1) { + long CSeq = 0; + char *endp; + char *p = &header[5]; + while(ISBLANK(*p)) + p++; + CSeq = strtol(p, &endp, 10); + if(p != endp) { struct RTSP *rtsp = data->req.p.rtsp; rtsp->CSeq_recv = CSeq; /* mark the request */ data->state.rtsp_CSeq_recv = CSeq; /* update the handle */