summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_vty.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 4ec0876411..4b6e626207 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -10849,10 +10849,10 @@ static char *bgp_peer_description_stripped(char *desc, uint32_t size)
{
static char stripped[BUFSIZ];
uint32_t i = 0;
- uint32_t last_space = 0;
+ uint32_t last_space = size;
while (i < size) {
- if (*(desc + i) == 0) {
+ if (*(desc + i) == '\0') {
stripped[i] = '\0';
return stripped;
}
@@ -10862,10 +10862,7 @@ static char *bgp_peer_description_stripped(char *desc, uint32_t size)
i++;
}
- if (last_space > size)
- stripped[size + 1] = '\0';
- else
- stripped[last_space] = '\0';
+ stripped[last_space] = '\0';
return stripped;
}