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

Panu Matilainen notifications at github.com
Tue Apr 21 05:20:53 UTC 2026


@pmatilai 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)) {

Lets use sizeof(lang) instead in case it changes size some day, otherwise seems ok to me.

Alternatively findPreambleTag() could be made to return a newly malloced string in case lang is present, that's what rpm mostly uses to avoid buffer overruns on strings. But that might require sprinkling some new NULL checks in the surrounding code, this is probably the less intrusive approach.

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

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


More information about the Rpm-maint mailing list