return;
if (edui_conf.program[0] == '\0')
- xstrncpy(prog, EDUI_PROGRAM_NAME, strlen(EDUI_PROGRAM_NAME));
+ xstrncpy(prog, EDUI_PROGRAM_NAME, sizeof(prog));
else
- xstrncpy(prog, edui_conf.program, strlen(edui_conf.program));
+ xstrncpy(prog, edui_conf.program, sizeof(prog));
if ((func == NULL) || (msg == NULL) || (strlen(prog) > 256)) {
snprintf(dbuf, sizeof(dbuf), "%s: local_debug() EPIC FAILURE.\n", prog);
fputs(dbuf, stderr);
return;
}
sz = sizeof(dbuf);
- memset(cbuf, '\0', strlen(cbuf));
- xstrncpy(cbuf, prog, strlen(prog));
+ memset(cbuf, '\0', sizeof(cbuf));
+ xstrncpy(cbuf, prog, sizeof(cbuf));
strncat(cbuf, ": [DB] ", 7);
strncat(cbuf, func, strlen(func));
strncat(cbuf, "() - ", 5);
if (x > 0) {
strncat(cbuf, dbuf, x);
fputs(cbuf, stderr);
- memset(dbuf, '\0', strlen(dbuf));
+ memset(dbuf, '\0', sizeof(dbuf));
} else {
snprintf(bbuf, sz, "%s: local_debug(%s) FAILURE: %zd\n", prog, dbuf, x);
fputs(bbuf, stderr);
return;
if (edui_conf.program[0] == '\0')
- xstrncpy(prog, EDUI_PROGRAM_NAME, strlen(EDUI_PROGRAM_NAME));
+ xstrncpy(prog, EDUI_PROGRAM_NAME, sizeof(prog));
else
- xstrncpy(prog, edui_conf.program, strlen(edui_conf.program));
+ xstrncpy(prog, edui_conf.program, sizeof(prog));
if ((msg == NULL) || (strlen(prog) > 256)) {
snprintf(dbuf, sizeof(dbuf), "%s: local_debugx() EPIC FAILURE.\n", prog);
fputs(dbuf, stderr);
va_end(ap);
if (x > 0) {
fputs(dbuf, stderr);
- memset(dbuf, '\0', strlen(dbuf));
+ memset(dbuf, '\0', sizeof(dbuf));
} else {
snprintf(bbuf, sz, "%s: local_debugx(%s) FAILURE: %zd\n", prog, dbuf, x);
fputs(bbuf, stderr);
va_list ap;
if (edui_conf.program[0] == '\0')
- xstrncpy(prog, EDUI_PROGRAM_NAME, strlen(EDUI_PROGRAM_NAME));
+ xstrncpy(prog, EDUI_PROGRAM_NAME, sizeof(prog));
else
- xstrncpy(prog, edui_conf.program, strlen(edui_conf.program));
+ xstrncpy(prog, edui_conf.program, sizeof(prog));
if ((msg == NULL) || (strlen(prog) > 256)) {
/* FAIL */
dbuf[x] = '\0';
x++;
fputs(dbuf, stdout);
- memset(dbuf, '\0', strlen(dbuf));
+ memset(dbuf, '\0', sizeof(dbuf));
} else {
/* FAIL */
/*
/* Search for :: in string */
if ((bufa[0] == ':') && (bufa[1] == ':')) {
/* bufa starts with a ::, so just copy and clear */
- xstrncpy(bufb, bufa, sizeof(bufa));
+ xstrncpy(bufb, bufa, sizeof(bufb));
memset(bufa, '\0', strlen(bufa));
swi++; /* Indicates that there is a bufb */
} else if ((bufa[0] == ':') && (bufa[1] != ':')) {
}
if (group == NULL) {
/* No groupMembership= to add, yay! */
- xstrncpy(bufa, "(&", 2);
+ xstrncpy(bufa, "(&", sizeof(bufa));
strncat(bufa, edui_conf.search_filter, strlen(edui_conf.search_filter));
/* networkAddress */
snprintf(bufb, sizeof(bufb), "(|(networkAddress=1\\23%s)", bufc);
strncat(bufa, ")", 1);
} else {
/* Needs groupMembership= to add... */
- xstrncpy(bufa, "(&(&", 4);
+ xstrncpy(bufa, "(&(&", sizeof(bufa));
strncat(bufa, edui_conf.search_filter, strlen(edui_conf.search_filter));
/* groupMembership -- NOTE: Squid *MUST* provide "cn=" from squid.conf */
snprintf(bufg, sizeof(bufg), "(groupMembership=%s", group);
strncat(bufa, "))", 2);
}
s = strlen(bufa);
- xstrncpy(l->search_filter, bufa, s);
+ xstrncpy(l->search_filter, bufa, sizeof(l->search_filter));
return s;
}
c = c + 256;
int hlen = snprintf(hexc, sizeof(hexc), "%.2X", c);
if (k == 0)
- xstrncpy(bufb, hexc, hlen);
+ xstrncpy(bufb, hexc, sizeof(bufb));
else
strncat(bufb, hexc, hlen);
}
/* We got a match! - Scan 'ber' for 'cn' values */
z = ldap_count_values_len(ber);
for (j = 0; j < z; j++)
- xstrncpy(uid, ber[j]->bv_val, ber[j]->bv_len);
+ xstrncpy(uid, ber[j]->bv_val, min(sizeof(uid),ber[j]->bv_len));
ldap_value_free_len(l->val);
l->val = NULL;
ldap_value_free_len(ber);
c = c + 256;
int hlen = snprintf(hexc, sizeof(hexc), "%.2X", c);
if (k == 2)
- xstrncpy(bufb, hexc, hlen);
+ xstrncpy(bufb, hexc, sizeof(bufb));
else
strncat(bufb, hexc, hlen);
}
/* We got a match! - Scan 'ber' for 'cn' values */
z = ldap_count_values_len(ber);
for (j = 0; j < z; j++)
- xstrncpy(uid, ber[j]->bv_val, ber[j]->bv_len);
+ xstrncpy(uid, ber[j]->bv_val, min(sizeof(uid),ber[j]->bv_len));
ldap_value_free_len(l->val);
l->val = NULL;
ldap_value_free_len(ber);
c = c + 256;
int hlen = snprintf(hexc, sizeof(hexc), "%.2X", c);
if (k == 2)
- xstrncpy(bufb, hexc, hlen);
+ xstrncpy(bufb, hexc, sizeof(bufb));
else
strncat(bufb, hexc, hlen);
}
/* We got a match! - Scan 'ber' for 'cn' values */
z = ldap_count_values_len(ber);
for (j = 0; j < z; j++)
- xstrncpy(uid, ber[j]->bv_val, ber[j]->bv_len);
+ xstrncpy(uid, ber[j]->bv_val, min(sizeof(uid),ber[j]->bv_len));
ldap_value_free_len(l->val);
l->val = NULL;
ldap_value_free_len(ber);
c = c + 256;
int hlen = snprintf(hexc, sizeof(hexc), "%.2X", c);
if (k == 2)
- xstrncpy(bufb, hexc, hlen);
+ xstrncpy(bufb, hexc, sizeof(bufb));
else
strncat(bufb, hexc, hlen);
}
/* We got a match! - Scan 'ber' for 'cn' values */
z = ldap_count_values_len(ber);
for (j = 0; j < z; j++)
- xstrncpy(uid, ber[j]->bv_val, ber[j]->bv_len);
+ xstrncpy(uid, ber[j]->bv_val, min(sizeof(uid),ber[j]->bv_len));
ldap_value_free_len(l->val);
l->val = NULL;
ldap_value_free_len(ber);
c = c + 256;
int hlen = snprintf(hexc, sizeof(hexc), "%.2X", c);
if (k == 2)
- xstrncpy(bufb, hexc, hlen);
+ xstrncpy(bufb, hexc, sizeof(bufb));
else
strncat(bufb, hexc, hlen);
}
/* We got a match! - Scan 'ber' for 'cn' values */
z = ldap_count_values_len(ber);
for (j = 0; j < z; j++)
- xstrncpy(uid, ber[j]->bv_val, ber[j]->bv_len);
+ xstrncpy(uid, ber[j]->bv_val, min(sizeof(uid),ber[j]->bv_len));
ldap_value_free_len(l->val);
l->val = NULL;
ldap_value_free_len(ber);