[Rpm-maint] [rpm-software-management/rpm] Prevent buffer overruns in findPreambleTag() for language string (PR #4188)

Dave Cantrell notifications at github.com
Tue Apr 21 13:04:40 UTC 2026


@dcantrell commented on this pull request.



> @@ -1254,7 +1259,7 @@ int parsePreamble(rpmSpec spec, int initialPackage, enum parseStages stage)
 	    linep = spec->line;
 	    SKIPSPACE(linep);
 	    if (*linep != '\0') {
-		if (findPreambleTag(spec, &p, &macro, lang)) {
+		if (findPreambleTag(spec, &p, &macro, lang, BUFSIZ)) {

Changing it to sizeof(lang).  I thought about adjusting everything to dynamically allocate the lang buffer, but that felt like overkill and would also risk introducing a potential NULL pointer dereference.

I think lang being BUFSIZ is large enough, but I say that now and just know down the road someone will come up with a language identifier token that is larger.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/4188?email_source=notifications&email_token=ADLPZU3II42IPRFIAW2YKFT4W5WWRA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIMJUG44DIMBWGQZ2M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOS6XA4S7OJSXM2LFO5PW433UNFTGSY3BORUW63TTL5RWY2LDNM#discussion_r3117600977
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/4188/review/4147840643 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260421/9a90b5fb/attachment.htm>


More information about the Rpm-maint mailing list