#include "occoaptoken.h"
#include "ocstackinternal.h"
-#define BUF_SIZE (64)
+/**
+ * The Max Size of the buffer that is used to parse uri and query
+ * individually.
+ */
+#define MAX_URI_QUERY_BUF_SIZE ((MAX_URI_LENGTH) >= (MAX_QUERY_LENGTH) ?\
+ (MAX_URI_LENGTH) : (MAX_QUERY_LENGTH))
// checks if optionID is within vendor specific range
OCStackResult isVendorSpecific(uint16_t optionID);
coap_list_t * optNode = NULL;
int res;
size_t buflen;
- unsigned char _buf[BUF_SIZE];
+ unsigned char _buf[MAX_URI_QUERY_BUF_SIZE];
unsigned char *buf = _buf;
if(addMediaType)
if(uri && uriLength)
{
buf = _buf;
- buflen = BUF_SIZE;
+ buflen = MAX_URI_QUERY_BUF_SIZE;
res = coap_split_path(uri, uriLength, buf, &buflen);
while (res--) {
optNode = CreateNewOptionNode(COAP_OPTION_URI_PATH,
if(query && queryLength)
{
buf = _buf;
- buflen = BUF_SIZE;
+ buflen = MAX_URI_QUERY_BUF_SIZE;
res = coap_split_query(query, queryLength, buf, &buflen);
while (res--) {
optNode = CreateNewOptionNode(COAP_OPTION_URI_QUERY,