Commit 8d6ad744c6 for ffmpeg
commit 8d6ad744c6262f8df1c4a233970ba5910f95c1c2
Author: zhang xingxing <2388969553@qq.com>
Date: Tue Oct 13 06:39:23 2026 +0200
avformat/rtmpproto: reject a llnw authentication challenge without a nonce
This is not a security issue.
Fixes: 6lFLlG49gRxf
Fixes: swarm-NULL-pointer-dereference-via-snprintf-s-with-NULL-nonce-83e8f3
Regression since: c1ea44c54d
NULL nonce passed to snprintf() Replicated through UnModified FFmpeg with a local RTMP server (the reconnect carried nonce=(null))
Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 785455e06d..392c559090 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -1760,8 +1760,7 @@ static int do_llnw_auth(RTMPContext *rt, const char *user, const char *nonce)
av_md5_init(md5);
av_md5_update(md5, hashstr1, strlen(hashstr1));
av_md5_update(md5, ":", 1);
- if (nonce)
- av_md5_update(md5, nonce, strlen(nonce));
+ av_md5_update(md5, nonce, strlen(nonce));
av_md5_update(md5, ":", 1);
av_md5_update(md5, nc, strlen(nc));
av_md5_update(md5, ":", 1);
@@ -1864,6 +1863,10 @@ static int handle_connect_error(URLContext *s, const char *desc)
if ((ret = do_adobe_auth(rt, user, salt, opaque, challenge)) < 0)
return ret;
} else {
+ if (!nonce) {
+ av_log(s, AV_LOG_ERROR, "No nonce in the llnw authentication challenge\n");
+ return AVERROR_UNKNOWN;
+ }
if ((ret = do_llnw_auth(rt, user, nonce)) < 0)
return ret;
}