Skip to content

Commit

Permalink
RT3230: Better test for C identifier
Browse files Browse the repository at this point in the history
objects.pl only looked for a space to see if the name could be
used as a C identifier.  Improve the test to match the real C
rules.

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 591b7ae)
  • Loading branch information
AnnieYousar authored and Rich Salz committed Jun 2, 2015
1 parent 858de87 commit fb22f74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions crypto/objects/objects.README
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ The basic syntax for adding an object is as follows:

1 2 3 4 : shortName : Long Name

If the long name doesn't contain spaces, or no short name
exists, the long name is used as basis for the base name
in C. Otherwise, the short name is used.
If Long Name contains only word characters and hyphen-minus
(0x2D) or full stop (0x2E) then Long Name is used as basis
for the base name in C. Otherwise, the shortName is used.

The base name (let's call it 'base') will then be used to
create the C macros SN_base, LN_base, NID_base and OBJ_base.
Expand All @@ -22,7 +22,7 @@ Then there are some extra commands:

!Alias foo 1 2 3 4

This juts makes a name foo for an OID. The C macro
This just makes a name foo for an OID. The C macro
OBJ_foo will be created as a result.

!Cname foo
Expand Down
2 changes: 1 addition & 1 deletion crypto/objects/objects.pl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
$myoid = &process_oid($myoid);
}

if ($Cname eq "" && !($myln =~ / /))
if ($Cname eq "" && ($myln =~ /^[_A-Za-z][\w.-]*$/ ))
{
$Cname = $myln;
$Cname =~ s/\./_/g;
Expand Down

0 comments on commit fb22f74

Please sign in to comment.