Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dhcp-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ dhcp_set_leasefile(char *leasefile, size_t len, int family,
const struct interface *ifp)
{
char ifname[(sizeof(ifp->name) * 4) + 1];
char ssid[1 + (IF_SSIDLEN * 4) + 1]; /* - prefix and NUL terminated. */
char ssid[1 + IF_SSIDSTRLEN]; /* - prefix and escaped SSID. */

if (ifp->name[0] == '\0') {
strlcpy(leasefile, ifp->ctx->pidfile, len);
Expand Down
2 changes: 1 addition & 1 deletion src/dhcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ struct dhcp_state {
struct ipv4_addr *addr;
uint8_t added;

char leasefile[sizeof(LEASEFILE) + IF_NAMESIZE + (IF_SSIDLEN * 4)];
char leasefile[sizeof(LEASEFILE) + IF_NAMESIZE + IF_SSIDSTRLEN];
struct timespec started;
unsigned char *clientid;
struct authstate auth;
Expand Down
2 changes: 1 addition & 1 deletion src/dhcp6.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ struct dhcp6_state {
struct ipv6_addrhead addrs;
uint32_t lowpl;
/* The +3 is for the possible .pd extension for prefix delegation */
char leasefile[sizeof(LEASEFILE6) + IF_NAMESIZE + (IF_SSIDLEN * 4) + 3];
char leasefile[sizeof(LEASEFILE6) + IF_NAMESIZE + IF_SSIDSTRLEN + 3];
const char *reason;
uint16_t lerror; /* Last error received from DHCPv6 reply. */
bool has_no_binding;
Expand Down
4 changes: 2 additions & 2 deletions src/dhcpcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ int
dhcpcd_selectprofile(struct interface *ifp, const char *profile)
{
struct if_options *ifo;
char pssid[PROFILE_LEN];
char pssid[IF_SSIDSTRLEN];

if (ifp->ssid_len) {
ssize_t r;
Expand Down Expand Up @@ -717,7 +717,7 @@ dhcpcd_initstate(struct interface *ifp, unsigned long long options)
static void
dhcpcd_reportssid(struct interface *ifp)
{
char pssid[IF_SSIDLEN * 4];
char pssid[IF_SSIDSTRLEN];

if (print_string(pssid, sizeof(pssid), OT_ESCSTRING, ifp->ssid,
ifp->ssid_len) == -1) {
Expand Down
2 changes: 2 additions & 0 deletions src/dhcpcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#define IF_SSIDLEN 32
#define PROFILE_LEN 64
#define SECRET_LEN 64
/* An escaped SSID needs four characters per-octet, plus terminating NUL */
#define IF_SSIDSTRLEN ((IF_SSIDLEN * 4) + 1)

#define IF_INACTIVE 0
#define IF_ACTIVE 1
Expand Down
2 changes: 1 addition & 1 deletion src/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ make_env(struct dhcpcd_ctx *ctx, const struct interface *ifp,
if (efprintf(fp, "ifmtu=%d", if_getmtu(ifp)) == -1)
goto eexit;
if (ifp->wireless) {
char pssid[IF_SSIDLEN * 4];
char pssid[IF_SSIDSTRLEN];

if (print_string(pssid, sizeof(pssid), OT_ESCSTRING, ifp->ssid,
ifp->ssid_len) != -1) {
Expand Down