Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24a36f9

Browse files
committed
Fix strsep() use for SCRAM secrets parsing
The previous code (from commit5d2e1cc) did not detect end ofstring correctly, so it would fail to error out if fewer than theexpected number of fields were present, which could then later lead toa crash when NULL string pointers are accessed.Reported-by: Alexander Lakhin <exclusion@gmail.com>Reported-by: Ranier Vilela <ranier.vf@gmail.com>Discussion:https://www.postgresql.org/message-id/flat/79692bf9-17d3-41e6-b9c9-fc8c3944222a@eisentraut.org
1 parent9272bde commit24a36f9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/backend/libpq/auth-scram.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,17 @@ parse_scram_secret(const char *secret, int *iterations,
608608
* SCRAM-SHA-256$<iterations>:<salt>$<storedkey>:<serverkey>
609609
*/
610610
v=pstrdup(secret);
611-
if ((scheme_str=strsep(&v,"$"))==NULL)
611+
scheme_str=strsep(&v,"$");
612+
if (v==NULL)
612613
gotoinvalid_secret;
613-
if ((iterations_str=strsep(&v,":"))==NULL)
614+
iterations_str=strsep(&v,":");
615+
if (v==NULL)
614616
gotoinvalid_secret;
615-
if ((salt_str=strsep(&v,"$"))==NULL)
617+
salt_str=strsep(&v,"$");
618+
if (v==NULL)
616619
gotoinvalid_secret;
617-
if ((storedkey_str=strsep(&v,":"))==NULL)
620+
storedkey_str=strsep(&v,":");
621+
if (v==NULL)
618622
gotoinvalid_secret;
619623
serverkey_str=v;
620624

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp