SOCK: Properly avoid mixing char * and const char * references
This commit is contained in:
parent
2209f25086
commit
d8e41d64a3
1 changed files with 10 additions and 8 deletions
16
sim_sock.c
16
sim_sock.c
|
@ -707,7 +707,8 @@ int status = -1;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
struct addrinfo *ai_validate;
|
struct addrinfo *ai_validate;
|
||||||
unsigned long bits = 0;
|
unsigned long bits = 0;
|
||||||
char *c, *c1, v_cpy[256];
|
const char *c;
|
||||||
|
char *c1, v_cpy[256];
|
||||||
|
|
||||||
if (validate_addr == NULL)
|
if (validate_addr == NULL)
|
||||||
return status;
|
return status;
|
||||||
|
@ -737,22 +738,23 @@ while ((*acl != '\0') && !done) {
|
||||||
struct addrinfo *ai_rule, *ai, *aiv;
|
struct addrinfo *ai_rule, *ai, *aiv;
|
||||||
int permit;
|
int permit;
|
||||||
unsigned long bits = 0;
|
unsigned long bits = 0;
|
||||||
|
const char *cc;
|
||||||
char *c,*c1, rule[260];
|
char *c,*c1, rule[260];
|
||||||
|
|
||||||
permit = (*acl == '+');
|
permit = (*acl == '+');
|
||||||
c = strchr (acl, ',');
|
cc = strchr (acl, ',');
|
||||||
if (c != NULL) {
|
if (cc != NULL) {
|
||||||
if ((c - acl) > sizeof (rule))
|
if ((cc - acl) > sizeof (rule))
|
||||||
break; /* Too big - error */
|
break; /* Too big - error */
|
||||||
memcpy (rule, acl + 1, c - (acl + 1));
|
memcpy (rule, acl + 1, cc - (acl + 1));
|
||||||
rule[c - (acl + 1)] = '\0';
|
rule[cc - (acl + 1)] = '\0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (strlen (acl) > sizeof (rule))
|
if (strlen (acl) > sizeof (rule))
|
||||||
break; /* Too big - error */
|
break; /* Too big - error */
|
||||||
strcpy (rule, acl + 1);
|
strcpy (rule, acl + 1);
|
||||||
}
|
}
|
||||||
acl += strlen (rule) + 1 + (c != NULL);
|
acl += strlen (rule) + 1 + (cc != NULL);
|
||||||
c = strchr (rule, '/');
|
c = strchr (rule, '/');
|
||||||
if (c != NULL) {
|
if (c != NULL) {
|
||||||
bits = strtoul (c + 1, &c1, 10);
|
bits = strtoul (c + 1, &c1, 10);
|
||||||
|
|
Loading…
Add table
Reference in a new issue