]> git.pld-linux.org Git - packages/coova-chilli.git/blob - strncpy.patch
- better fix for buffer overflow problem (inspired by svn trunk)
[packages/coova-chilli.git] / strncpy.patch
1 --- coova-chilli-1.2.4/src/chilli.c.orig        2010-08-24 13:29:08.000000000 +0200
2 +++ coova-chilli-1.2.4/src/chilli.c     2010-09-30 13:26:40.000000000 +0200
3 @@ -966,8 +966,15 @@
4  
5      strncpy(appconn->s_state.redir.username, mac, USERNAMESIZE);
6  
7 -    if (_options.macsuffix)
8 -      strncat(appconn->s_state.redir.username, _options.macsuffix, USERNAMESIZE);
9 +    if (_options.macsuffix) {
10 +      size_t ulen = strlen(appconn->s_state.redir.username + ulen);
11 +      size_t size = USERNAMESIZE - ulen;
12 +
13 +      if (size) {
14 +        appconn->s_state.redir.username[--size + ulen] = '\0';
15 +        strncpy(appconn->s_state.redir.username + ulen, _options.macsuffix, size);
16 +      }
17 +    }
18    
19      username = appconn->s_state.redir.username;
20    } else {
This page took 0.068925 seconds and 4 git commands to generate.