Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardisation of port map description length to 1016 #746

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
Standardisation of port map description length to 1016
  • Loading branch information
Self-Hosting-Group committed Jun 11, 2024
commit 3cb5571c6552f322fd6784d6a6bb8fd6f6cf6651
4 changes: 2 additions & 2 deletions miniupnpc/include/upnpcommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
* in remoteHost
* out intClient (16 bytes)
* out intPort (6 bytes)
* out desc (80 bytes)
* out desc (1016 bytes)
* out enabled (4 bytes)
* out leaseDuration (16 bytes)
*
Expand Down Expand Up @@ -252,7 +252,7 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
* out intClient (16 bytes)
* out intPort (6 bytes)
* out protocol (4 bytes)
* out desc (80 bytes)
* out desc (1016 bytes)
* out enabled (4 bytes)
* out rHost (64 bytes)
* out duration (16 bytes)
Expand Down
4 changes: 2 additions & 2 deletions miniupnpc/src/miniupnpcmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ UPnP_getspecificportmapping(UPnPObject *self, PyObject *args)
char intClient[40];
char intPort[6];
unsigned short iPort;
char desc[80];
char desc[1016];
char enabled[4];
char leaseDuration[16];
if(!PyArg_ParseTuple(args, "Hs|z", &ePort, &proto, &remoteHost))
Expand Down Expand Up @@ -530,7 +530,7 @@ UPnP_getgenericportmapping(UPnPObject *self, PyObject *args)
char extPort[6];
unsigned short ePort;
char protocol[4];
char desc[80];
char desc[1016];
char enabled[6];
char rHost[64];
char duration[16]; /* lease duration */
Expand Down
2 changes: 1 addition & 1 deletion miniupnpc/src/upnpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static void ListRedirections(struct UPNPUrls * urls,
char intPort[6];
char extPort[6];
char protocol[4];
char desc[80];
char desc[1016];
char enabled[6];
char rHost[64];
char duration[16];
Expand Down
8 changes: 4 additions & 4 deletions miniupnpc/src/upnpcommands.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,8 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
p = GetValueFromNameValueList(&pdata, "NewPortMappingDescription");
if(p && desc)
{
strncpy(desc, p, 80);
desc[79] = '\0';
strncpy(desc, p, 1016);
desc[1015] = '\0';
}
p = GetValueFromNameValueList(&pdata, "NewLeaseDuration");
if(p && duration)
Expand Down Expand Up @@ -764,8 +764,8 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,

p = GetValueFromNameValueList(&pdata, "NewPortMappingDescription");
if(p && desc) {
strncpy(desc, p, 80);
desc[79] = '\0';
strncpy(desc, p, 1016);
desc[1015] = '\0';
}

p = GetValueFromNameValueList(&pdata, "NewLeaseDuration");
Expand Down
4 changes: 2 additions & 2 deletions miniupnpd/miniupnpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ tomato_save(const char *fname)
unsigned int timestamp;
char proto[4];
char iaddr[32];
char desc[64];
char desc[1016];
char rhost[32];
int n;
FILE *f;
Expand Down Expand Up @@ -239,7 +239,7 @@ tomato_delete(void)
unsigned int leaseduration;
char proto[4];
char iaddr[32];
char desc[64];
char desc[1016];
char rhost[32];
int n;

Expand Down
6 changes: 3 additions & 3 deletions miniupnpd/pcpserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ typedef struct pcp_info {
int pfailure_present;
struct in6_addr sender_ip;
int is_fw; /* is this firewall operation? if not, nat. */
char desc[64];
char desc[1016];
} pcp_info_t;

/* getPCPOpCodeStr()
Expand Down Expand Up @@ -842,7 +842,7 @@ static void DeletePCPPeer(pcp_info_t *pcp_msg_info)
unsigned short eport2, iport2, rport2;
char iaddr2[INET6_ADDRSTRLEN], rhost2[INET6_ADDRSTRLEN];
int proto2;
char desc[64];
char desc[1016];
unsigned int timestamp;
#if 0
int uid;
Expand Down Expand Up @@ -1099,7 +1099,7 @@ static void DeletePCPMap(pcp_info_t *pcp_msg_info)
unsigned short eport2, iport2;
char iaddr2[INET6_ADDRSTRLEN];
int proto2;
char desc[64];
char desc[1016];
unsigned int timestamp;

syslog(LOG_DEBUG, "is_fw=%d addr=%s iport=%hu proto=%d",
Expand Down
6 changes: 3 additions & 3 deletions miniupnpd/upnpredirect.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void lease_file_rewrite(void)
unsigned short eport, iport;
int proto;
char iaddr[32];
char desc[64];
char desc[1016];
char rhost[40];
unsigned int timestamp;

Expand Down Expand Up @@ -588,7 +588,7 @@ upnp_get_portmapping_number_of_entries(void)
#else
int n = 0, r = 0;
unsigned short eport, iport;
char protocol[8], iaddr[32], desc[64], rhost[32];
char protocol[8], iaddr[32], desc[1016], rhost[32];
unsigned int leaseduration;
do {
protocol[0] = '\0'; iaddr[0] = '\0'; desc[0] = '\0';
Expand Down Expand Up @@ -760,7 +760,7 @@ write_ruleset_details(int s)
{
int proto = 0;
unsigned short eport, iport;
char desc[64];
char desc[1016];
char iaddr[32];
char rhost[32];
unsigned int timestamp;
Expand Down
6 changes: 3 additions & 3 deletions miniupnpd/upnpsoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ GetSpecificPortMappingEntry(struct upnphttp * h, const char * action, const char
const char * r_host, * ext_port, * protocol;
unsigned short eport, iport;
char int_ip[32];
char desc[64];
char desc[1016];
unsigned int leaseduration = 0;

ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
Expand Down Expand Up @@ -1043,7 +1043,7 @@ GetGenericPortMappingEntry(struct upnphttp * h, const char * action, const char
const char * m_index;
char * endptr;
char protocol[8], iaddr[32];
char desc[64];
char desc[1016];
char rhost[40];
unsigned int leaseduration = 0;
struct NameValueParserData data;
Expand Down Expand Up @@ -1140,7 +1140,7 @@ GetListOfPortMappings(struct upnphttp * h, const char * action, const char * ns)
int r = -1;
unsigned short iport;
char int_ip[32];
char desc[64];
char desc[1016];
char rhost[64];
unsigned int leaseduration = 0;

Expand Down