error_t httpClientSetUri(HttpClientContext *context, const char_t *uri)
{
   size_t m;
   size_t n;
   char_t *p;
   char_t *q;

   //Check parameters
   if(context == NULL || uri == NULL)
      return ERROR_INVALID_PARAMETER;

   //The resource name must not be empty
   if(uri[0] == '\0')
      return ERROR_INVALID_PARAMETER;

   //Check HTTP request state
   if(context->requestState != HTTP_REQ_STATE_FORMAT_HEADER)
      return ERROR_WRONG_STATE;

   //Make sure the buffer contains a valid HTTP request
   if(context->bufferLen > HTTP_CLIENT_BUFFER_SIZE)
      return ERROR_INVALID_SYNTAX;

   //Properly terminate the string with a NULL character
   context->buffer[context->bufferLen] = '\0';

   //The Request-Line begins with a method token
   p = strchr(context->buffer, ' ');
   //Any parsing error?
   if(p == NULL)
      return ERROR_INVALID_SYNTAX;

   //The method token is followed by the Request-URI
   p++;

   //Point to the end of the Request-URI
   q = strpbrk(p, " ?");
   //Any parsing error?
   if(q == NULL)
      return ERROR_INVALID_SYNTAX;

   //Compute the length of the current URI
   m = q - p;
   //Compute the length of the new URI
   n = osStrlen(uri);

   //Make sure the buffer is large enough to hold the new resource name
   if((context->bufferLen + n - m) > HTTP_CLIENT_BUFFER_SIZE)
      return ERROR_BUFFER_OVERFLOW;

   //Make room for the new resource name
   osMemmove(p + n, q, context->buffer + context->bufferLen + 1 - q);
   //Copy the new resource name
   osStrncpy(p, uri, n);

   //Adjust the length of the request header
   context->bufferLen = context->bufferLen + n - m;

   //Successful processing
   return NO_ERROR;
}
The product receives input or data, but it does
        not validate or incorrectly validates that the input has the
        properties that are required to process the data safely and
        correctly.