File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -790,7 +790,8 @@ sanitize_str(const char *s)
790
790
/*
791
791
* Read the next attribute and value in a SCRAM exchange message.
792
792
*
793
- * Returns NULL if there is attribute.
793
+ * The attribute character is set in *attr_p, the attribute value is the
794
+ * return value.
794
795
*/
795
796
static char *
796
797
read_any_attr (char * * input , char * attr_p )
@@ -799,6 +800,12 @@ read_any_attr(char **input, char *attr_p)
799
800
char * end ;
800
801
char attr = * begin ;
801
802
803
+ if (attr == '\0' )
804
+ ereport (ERROR ,
805
+ (errcode (ERRCODE_PROTOCOL_VIOLATION ),
806
+ errmsg ("malformed SCRAM message" ),
807
+ errdetail ("Attribute expected, but found end of string." )));
808
+
802
809
/*------
803
810
* attr-val = ALPHA "=" value
804
811
* ;; Generic syntax of any attribute sent
@@ -1298,7 +1305,7 @@ read_client_final_message(scram_state *state, const char *input)
1298
1305
1299
1306
state -> client_final_nonce = read_attr_value (& p , 'r' );
1300
1307
1301
- /* ignore optional extensions */
1308
+ /* ignore optional extensions, read until we find "p" attribute */
1302
1309
do
1303
1310
{
1304
1311
proof = p - 1 ;
You can’t perform that action at this time.
0 commit comments