Skip to content

cups-browsed: fix BrowseAllow /0, link-local check and overwritten queue result - #79

Merged
tillkamppeter merged 1 commit into
OpenPrinting:masterfrom
Ar-maan05:small-fixes
Nov 2, 2026
Merged

tillkamppeter merged 1 commit into
OpenPrinting:masterfrom
Ar-maan05:small-fixes

Conversation

@Ar-maan05

Copy link
Copy Markdown
Contributor

three small unrelated fixes in cups-browsed.c, happy to split them if you prefer.

BrowseAllow 0.0.0.0/0 builds the wrong mask, since shifting by 32 is undefined:

before: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
        mask=255.255.255.255
after:  mask=0.0.0.0

other prefixes like /24 and /8 come out the same as before.

the link-local check has addrstr[6] == 'B' twice and is missing 'b', so feb* addresses don't get their interface name added.

queue_overwritten() sets its result to 2 for a changed PPD even when it already found a changed device URI. the caller treats 2 as "only the PPD got overwritten" and re-creates the queue, wich undoes the user's URI change. now it stays 1 in that case, so the queue gets released.

i only ran the BrowseAllow one, with a small harness before and after. the other two need a live cupsd or avahi so i checked those by reading the code.

…eue result

"BrowseAllow 0.0.0.0/0" shifted a 32-bit value by 32, wich is undefined and gave a mask of 255.255.255.255 on x86 instead of 0.0.0.0, so it matched almost nothing.

the link-local address check tested for 'B' twice and never for 'b', so lowercase feb* addresses didn't get their interface added.

queue_overwritten() set its result to 2 when the PPD changed even if it had just found a changed device URI. the queue was then re-created instead of being released, undoing the users change. only use 2 if the device URI is unchanged, as the caller expects.
@tillkamppeter
tillkamppeter merged commit 6813bf5 into OpenPrinting:master Nov 2, 2026
11 checks passed
@Ar-maan05
Ar-maan05 deleted the small-fixes branch November 2, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants