Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- What am I doing wrong in the add function? Not 100% sure about lengths of things and making sure the null terminator is included. Must be doing something wrong as the app crashes soon after calling add and iterating the list ends up showing a list of corrupt values.
- typedef struct karma_ssid{
- int length;
- char *ssid;
- struct karma_ssid *next;
- } karma_ssid_t;
- static int hostapd_ctrl_iface_karma_add_essid (struct hostapd_data *hapd,
- const char *essid) {
- wpa_printf(MSG_DEBUG, "CTRL_IFACE KARMA ADD ESSID %s", essid);
- char s[HOSTAPD_MAX_SSID_LEN + 1]; // +1 for null terminator
- karma_ssid_t *karma_ssid;
- if (strlen(essid) > HOSTAPD_MAX_SSID_LEN || strlen(essid) == 0) {
- return -1;
- }
- os_memcpy(s, essid, strlen(essid));
- wpa_printf(MSG_DEBUG, "CTRL_IFACE KARMA ADD ESSID %s", s);
- karma_ssid = os_malloc (sizeof (karma_ssid_t));
- karma_ssid->length = strlen(essid);
- karma_ssid->ssid = s;
- karma_ssid->next = hapd->iconf->karma_list;
- hapd->iconf->karma_list = karma_ssid;
- wpa_printf(MSG_DEBUG, "CTRL_IFACE KARMA ADDED SUCCESSFULLY");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement