From bcc78b7ea52892e471a88692ac40002817da338a Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 30 Apr 2004 10:24:12 +0000 Subject: [PATCH] removePrefix(): fixed case when len<4 git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1530 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/lib/bcaps-v13.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util-vserver/lib/bcaps-v13.c b/util-vserver/lib/bcaps-v13.c index 6918158..a75f8cf 100644 --- a/util-vserver/lib/bcaps-v13.c +++ b/util-vserver/lib/bcaps-v13.c @@ -70,8 +70,9 @@ static struct Mapping_uint64 const VALUES[] = { inline static char const * removePrefix(char const *str, size_t *len) { - if (strncasecmp("cap_", str, 4)==0) { - if (len && *len) *len -= 4; + if ((len==0 || *len==0 || *len>=4) && + strncasecmp("cap_", str, 4)==0) { + if (len && *len>=4) *len -= 4; return str+4; } else -- 1.8.1.5