Skip to content

Commit

Permalink
ldap: prevent possible buffer overflow
Browse files Browse the repository at this point in the history
Fixes Coverity CID #40879
  • Loading branch information
razvancrainea committed Jul 22, 2020
1 parent f38dec2 commit 108a5d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/ldap/iniparser.c
Expand Up @@ -177,11 +177,15 @@ is statically allocated, it will be modified at each function call
{
static char l[ASCIILINESZ+1];
char * last ;
int len;

if (s==NULL) return NULL ;
memset(l, 0, ASCIILINESZ+1);
len = strlen(s);
if (len > ASCIILINESZ) return NULL;

strcpy(l, s);
last = l + strlen(l);
last = l + len;
while (last > l) {
if (!isspace((int)*(last-1)))
break ;
Expand Down

0 comments on commit 108a5d4

Please sign in to comment.