/[svn]/ircd-hybrid/trunk/src/patricia.c
ViewVC logotype

Diff of /ircd-hybrid/trunk/src/patricia.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8596 by michael, Mon Oct 22 17:56:33 2018 UTC revision 8597 by michael, Mon Oct 22 18:53:58 2018 UTC
# Line 137  New_Prefix(int family, void *dest, int b Line 137  New_Prefix(int family, void *dest, int b
137  static prefix_t *  static prefix_t *
138  ascii2prefix(int family, const char *string)  ascii2prefix(int family, const char *string)
139  {  {
140    char save[MAXLINE];    char save[INET6_ADDRSTRLEN];
141    int bitlen, maxbitlen = 0;    int bitlen, maxbitlen = 0;
142    union    union
143    {    {
# Line 164  ascii2prefix(int family, const char *str Line 164  ascii2prefix(int family, const char *str
164    const char *const cp = strchr(string, '/');    const char *const cp = strchr(string, '/');
165    if (cp)    if (cp)
166    {    {
167        size_t strlen = cp - string;
168    
169        if (strlen >= sizeof(save))
170          return NULL;
171    
172      bitlen = atoi(cp + 1);      bitlen = atoi(cp + 1);
173    
     /* *cp = '\0'; */  
174      /* Copy the string to save. Avoid destroying the string */      /* Copy the string to save. Avoid destroying the string */
175      assert(cp - string < MAXLINE);      memcpy(save, string, strlen);
176      memcpy(save, string, cp - string);      save[strlen] = '\0';
177    
     save[cp - string] = '\0';  
178      string = save;      string = save;
179    
180      if (bitlen < 0 || bitlen > maxbitlen)      if (bitlen < 0 || bitlen > maxbitlen)

Legend:
Removed from v.8596  
changed lines
  Added in v.8597

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28