examples: length-limit two sscanf() uses of %s

Reported-by: Jishan Shaikh
Fixes #7293
Closes #7294
This commit is contained in:
Daniel Stenberg 2021-06-24 09:24:37 +02:00
parent 0842175fa4
commit 42db4ccee2
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 3 additions and 3 deletions

View File

@ -173,7 +173,7 @@ static void get_media_control_attribute(const char *sdp_filename,
control[0] = '\0';
if(sdp_fp != NULL) {
while(fgets(s, max_len - 2, sdp_fp) != NULL) {
sscanf(s, " a = control: %s", control);
sscanf(s, " a = control: %32s", control);
}
fclose(sdp_fp);
}

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -155,7 +155,7 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
TmpStr1 & 2? */
AutoSyncTime = 0;
else {
int RetVal = sscanf((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu",
int RetVal = sscanf((char *)(ptr), "Date: %25s %hu %s %hu %hu:%hu:%hu",
TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear,
&SYSTime.wHour, &SYSTime.wMinute,
&SYSTime.wSecond);