-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pimd: fix misuse of xpath buf size constants #10395
Conversation
Continuous Integration Result: SUCCESSFULContinuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2908/ This is a comment from an automated CI system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok in principle, but no assert please.
pimd/pim_cmd.c
Outdated
printed = snprintf(group_list_xpath, sizeof(group_list_xpath), | ||
"%s/group-list", rp_xpath); | ||
|
||
assert(printed <= (int)sizeof(group_list_xpath) && "Xpath too long"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do NOT make this assert
s, we're getting input from a user on a vty
here, so that's where an error report should go, and not result in just crashing the daemon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put asserts here to kind of force the issue, to make the point that this should never happen if XPATH_MAXLEN
is actually the maximum length of an xpath.
Since the build's currently broken I can change it to vty error messages but I think this bears further consideration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually all of these have the comparison backwards wrong too, it should be a strict <
😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the assert/vty_out discussion – what do we expect users to do when they receive "Xpath too long" error? None of those commands has variable-length arguments (I don't count IP address as such), so there's actually nothing user can do in this case.
It's up to the developer to make sure that XPATH_MAX is enough so probably assert is better here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this @idryzhov. I'm not too concerned with that, I'm only concerned at the moment with fixing the build in a not totally wrong way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix is fine, but would be great to introduce a function for that, something like:
void xpath_format(char *s, const char *format, ...)
{
int printed;
va_list args;
va_start(args, format);
printed = vsnprintf(s, XPATH_MAXLEN, format, args);
va_end(args);
assert(printed <= XPATH_MAXLEN && "Xpath too long");
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good other than David's comment ...
d92847f
to
f80b9ee
Compare
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: FailedUbuntu 16.04 i386 build: Failed (click for details)Ubuntu 16.04 i386 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U1604I386/config.log/config.log.gz Ubuntu 16.04 i386 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U1604I386/config.status/config.statusMake failed for Ubuntu 16.04 i386 build:
Ubuntu 18.04 i386 build: Failed (click for details)Make failed for Ubuntu 18.04 i386 build:
Ubuntu 18.04 i386 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U18I386BUILD/config.status/config.status Ubuntu 18.04 amd64 build: Failed (click for details)Ubuntu 18.04 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U1804AMD64/config.log/config.log.gz Ubuntu 18.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U1804AMD64/config.status/config.statusMake failed for Ubuntu 18.04 amd64 build:
Debian 11 amd64 build: Failed (click for details)Debian 11 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/DEB11AMD64/config.log/config.log.gzMake failed for Debian 11 amd64 build:
Debian 11 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/DEB11AMD64/config.status/config.status Ubuntu 18.04 arm7 build: Failed (click for details)Ubuntu 18.04 arm7 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U18ARM7BUILD/config.status/config.status Ubuntu 18.04 arm7 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U18ARM7BUILD/config.log/config.log.gzMake failed for Ubuntu 18.04 arm7 build:
FreeBSD 11 amd64 build: Failed (click for details)FreeBSD 11 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/CI009BUILD/config.log/config.log.gz FreeBSD 11 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/CI009BUILD/config.status/config.statusMake failed for FreeBSD 11 amd64 build:
Ubuntu 16.04 arm8 build: Failed (click for details)Ubuntu 16.04 arm8 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U16ARM8BUILD/config.status/config.status Ubuntu 16.04 arm8 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U16ARM8BUILD/config.log/config.log.gzMake failed for Ubuntu 16.04 arm8 build:
Ubuntu 16.04 amd64 build: Failed (click for details)Ubuntu 16.04 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/CI014BUILD/config.log/config.log.gz Ubuntu 16.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/CI014BUILD/config.status/config.statusMake failed for Ubuntu 16.04 amd64 build:
Redhat 8 amd64 build: Failed (click for details)Redhat 8 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/REDHAT8/config.status/config.statusMake failed for Redhat 8 amd64 build:
Redhat 8 amd64 build: Unknown Log <config.log.gz> NetBSD 9 amd64 build: Failed (click for details)NetBSD 9 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/CI012BUILD/config.status/config.statusMake failed for NetBSD 9 amd64 build:
NetBSD 9 amd64 build: Unknown Log <config.log.gz> FreeBSD 12 amd64 build: Failed (click for details)FreeBSD 12 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/FBSD12AMD64/config.log/config.log.gz FreeBSD 12 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/FBSD12AMD64/config.status/config.statusMake failed for FreeBSD 12 amd64 build:
Fedora 29 amd64 build: Failed (click for details)Fedora 29 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/F29BUILD/config.log/config.log.gz Fedora 29 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/F29BUILD/config.status/config.statusMake failed for Fedora 29 amd64 build:
Ubuntu 18.04 arm8 build: Failed (click for details)Make failed for Ubuntu 18.04 arm8 build:
Ubuntu 18.04 arm8 build: Unknown Log <config.log.gz> Debian 9 amd64 build: Failed (click for details)Debian 9 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/CI021BUILD/config.log/config.log.gz Debian 9 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/CI021BUILD/config.status/config.statusMake failed for Debian 9 amd64 build:
Ubuntu 20.04 amd64 build: Failed (click for details)Ubuntu 20.04 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U2004AMD64BUILD/config.log/config.log.gzMake failed for Ubuntu 20.04 amd64 build:
Ubuntu 20.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U2004AMD64BUILD/config.status/config.status Ubuntu 18.04 ppc64le build: Failed (click for details)Ubuntu 18.04 ppc64le build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U1804PPC64LEBUILD/config.log/config.log.gz Ubuntu 18.04 ppc64le build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/U1804PPC64LEBUILD/config.status/config.statusMake failed for Ubuntu 18.04 ppc64le build:
Debian 10 amd64 build: Failed (click for details)Debian 10 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2928/artifact/DEB10BUILD/config.status/config.statusMake failed for Debian 10 amd64 build:
Debian 10 amd64 build: Unknown Log <config.log.gz> Ubuntu 16.04 arm7 build: Failed (click for details)Make failed for Ubuntu 16.04 arm7 build:
Ubuntu 16.04 arm7 build: Unknown Log <config.log.gz> Successful on other platforms/tests
|
f80b9ee
to
849fbc1
Compare
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: FailedUbuntu 18.04 i386 build: Failed (click for details)Make failed for Ubuntu 18.04 i386 build:
Ubuntu 18.04 i386 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U18I386BUILD/config.status/config.status Debian 11 amd64 build: Failed (click for details)Debian 11 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/DEB11AMD64/config.log/config.log.gzMake failed for Debian 11 amd64 build:
Debian 11 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/DEB11AMD64/config.status/config.status Ubuntu 16.04 i386 build: Failed (click for details)Ubuntu 16.04 i386 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U1604I386/config.log/config.log.gz Ubuntu 16.04 i386 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U1604I386/config.status/config.statusMake failed for Ubuntu 16.04 i386 build:
Ubuntu 18.04 amd64 build: Failed (click for details)Ubuntu 18.04 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U1804AMD64/config.log/config.log.gz Ubuntu 18.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U1804AMD64/config.status/config.statusMake failed for Ubuntu 18.04 amd64 build:
Ubuntu 16.04 amd64 build: Failed (click for details)Ubuntu 16.04 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/CI014BUILD/config.log/config.log.gz Ubuntu 16.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/CI014BUILD/config.status/config.statusMake failed for Ubuntu 16.04 amd64 build:
Ubuntu 18.04 arm7 build: Failed (click for details)Ubuntu 18.04 arm7 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U18ARM7BUILD/config.status/config.status Ubuntu 18.04 arm7 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U18ARM7BUILD/config.log/config.log.gzMake failed for Ubuntu 18.04 arm7 build:
NetBSD 9 amd64 build: Failed (click for details)NetBSD 9 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/CI012BUILD/config.status/config.statusMake failed for NetBSD 9 amd64 build:
NetBSD 9 amd64 build: Unknown Log <config.log.gz> CentOS 7 amd64 build: Failed (click for details)CentOS 7 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/CI005BUILD/config.log/config.log.gz CentOS 7 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/CI005BUILD/config.status/config.statusMake failed for CentOS 7 amd64 build:
Ubuntu 16.04 arm8 build: Failed (click for details)Ubuntu 16.04 arm8 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U16ARM8BUILD/config.status/config.status Ubuntu 16.04 arm8 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U16ARM8BUILD/config.log/config.log.gzMake failed for Ubuntu 16.04 arm8 build:
Redhat 8 amd64 build: Failed (click for details)Redhat 8 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/REDHAT8/config.status/config.statusMake failed for Redhat 8 amd64 build:
Redhat 8 amd64 build: Unknown Log <config.log.gz> FreeBSD 12 amd64 build: Failed (click for details)FreeBSD 12 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/FBSD12AMD64/config.log/config.log.gz FreeBSD 12 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/FBSD12AMD64/config.status/config.statusMake failed for FreeBSD 12 amd64 build:
Fedora 29 amd64 build: Failed (click for details)Fedora 29 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/F29BUILD/config.log/config.log.gz Fedora 29 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/F29BUILD/config.status/config.statusMake failed for Fedora 29 amd64 build:
Ubuntu 18.04 arm8 build: Failed (click for details)Make failed for Ubuntu 18.04 arm8 build:
Ubuntu 18.04 arm8 build: Unknown Log <config.log.gz> Ubuntu 20.04 amd64 build: Failed (click for details)Ubuntu 20.04 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U2004AMD64BUILD/config.log/config.log.gzMake failed for Ubuntu 20.04 amd64 build:
Ubuntu 20.04 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U2004AMD64BUILD/config.status/config.status Debian 9 amd64 build: Failed (click for details)Debian 9 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/CI021BUILD/config.log/config.log.gz Debian 9 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/CI021BUILD/config.status/config.statusMake failed for Debian 9 amd64 build:
Ubuntu 18.04 ppc64le build: Failed (click for details)Ubuntu 18.04 ppc64le build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U1804PPC64LEBUILD/config.log/config.log.gz Ubuntu 18.04 ppc64le build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/U1804PPC64LEBUILD/config.status/config.statusMake failed for Ubuntu 18.04 ppc64le build:
Debian 10 amd64 build: Failed (click for details)Debian 10 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/DEB10BUILD/config.status/config.statusMake failed for Debian 10 amd64 build:
Debian 10 amd64 build: Unknown Log <config.log.gz> FreeBSD 11 amd64 build: Failed (click for details)FreeBSD 11 amd64 build: Unknown Log URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/CI009BUILD/config.log/config.log.gz FreeBSD 11 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-PULLREQ2-2929/artifact/CI009BUILD/config.status/config.statusMake failed for FreeBSD 11 amd64 build:
Ubuntu 16.04 arm7 build: Failed (click for details)Make failed for Ubuntu 16.04 arm7 build:
Ubuntu 16.04 arm7 build: Unknown Log <config.log.gz> Successful on other platforms/tests
|
Outdated results 🛑Basic BGPD CI results: FAILURE
For details, please contact louberger |
XPATH_MAXLEN denotes the maximum length of an XPATH. It does not make sense to allocate a buffer intended to contain an XPATH with a size larger than the maximum allowable size of an XPATH. Consequently this PR removes buffers that do this. Prints into these buffers are now checked for overflow. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
849fbc1
to
d7073b2
Compare
silly me :) |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-2960/ This is a comment from an automated CI system. |
XPATH_MAXLEN
denotes the maximum length of anXPATH
. It does not makesense to allocate a buffer intended to contain an
XPATH
with a sizelarger than the maximum allowable size of an
XPATH
. Consequently this PRremoves buffers that do this. Prints into these buffers are now checked
for overflow.
This is an alternative to #10394.
Signed-off-by: Quentin Young qlyoung@nvidia.com