Bug 1562

Summary: EXPAND_MAX_KEYS in percent_expand is actually (EXPAND_MAX_KEYS - 1)
Product: Portable OpenSSH Reporter: Jan Pechanec <Jan.Pechanec>
Component: MiscellaneousAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: minor CC: djm
Priority: P4    
Version: 5.2p1   
Hardware: Other   
OS: Solaris   
Bug Depends on:    
Bug Blocks: 1626    
Attachments:
Description Flags
suggested patch none

Description Jan Pechanec 2009-02-26 02:27:54 AEDT
Created attachment 1607 [details]
suggested patch

it may be a nit picking: EXPAND_MAX_KEYS, as any MAX macro, suggests that we can have up to EXPAND_MAX_KEYS keys. That's not true since if we reach the maximum, the following test bails out:

        if (num_keys >= EXPAND_MAX_KEYS)
                fatal("percent_expand: too many keys");

it's not a problem here since 16 becomes 15 which is still large enough but the issue is there anyway. I'm attaching a patch. In the patch changes, two "==" strings can be changed to ">=" if you feel it's better in terms of possible future updates. However, "==" is enough there.
Comment 1 Damien Miller 2009-11-20 14:24:23 AEDT
patch applied, will be in openssh-5.4
Comment 2 Darren Tucker 2010-03-26 10:51:23 AEDT
With the release of 5.4p1, this bug is now considered closed.