mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 14:04:32 +00:00
Merge pull request #12866 from anlancs/lib/dotas-zero
lib: some ASNUMs should be forbidden
This commit is contained in:
commit
148ad13257
12
lib/asn.c
12
lib/asn.c
@ -52,6 +52,10 @@ static bool asn_str2asn_internal(const char *asstring, as_t *asn,
|
|||||||
if (!isdigit((unsigned char)*p))
|
if (!isdigit((unsigned char)*p))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
/* leading zero is forbidden */
|
||||||
|
if (*p == '0' && isdigit((unsigned char)*(p + 1)))
|
||||||
|
goto end;
|
||||||
|
|
||||||
temp_val = 0;
|
temp_val = 0;
|
||||||
while (isdigit((unsigned char)*p)) {
|
while (isdigit((unsigned char)*p)) {
|
||||||
digit = (*p) - '0';
|
digit = (*p) - '0';
|
||||||
@ -65,11 +69,17 @@ static bool asn_str2asn_internal(const char *asstring, as_t *asn,
|
|||||||
high = (uint32_t)temp_val;
|
high = (uint32_t)temp_val;
|
||||||
if (*p == '.') { /* dot format */
|
if (*p == '.') { /* dot format */
|
||||||
p++;
|
p++;
|
||||||
temp_val = 0;
|
|
||||||
if (*p == '\0' && partial) {
|
if (*p == '\0' && partial) {
|
||||||
*partial = true;
|
*partial = true;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* leading zero is forbidden */
|
||||||
|
if (*p == '0' && isdigit((unsigned char)*(p + 1)))
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
temp_val = 0;
|
||||||
while (isdigit((unsigned char)*p)) {
|
while (isdigit((unsigned char)*p)) {
|
||||||
digit = (*p) - '0';
|
digit = (*p) - '0';
|
||||||
temp_val *= 10;
|
temp_val *= 10;
|
||||||
|
Loading…
Reference in New Issue
Block a user