title: Malloc returning invalid size error when allocating memory
body: <p>I have this function for forming a HTTP request string. When running, malloc returns an error:</p>
  <p>malloc(): invalid size (unsorted)
  Aborted</p>
  <p>Below is the function I created, cannot understand why this is returning an error.</p>
  <pre><code>char* integration_request(char* function, char* lower, char* upper,
          char* segments, char* threads) {
  
  char* start = &quot;GET /integrate/&quot;;
  char* bs = &quot;/&quot;;
  char* end = &quot;HTTP/1.1\n\n&quot;;
  char* request = malloc(sizeof(char) * strlen(start + 1));
  strcpy(request, start);
  
  strcat(request, lower);
  strcat(request, bs);
  
  strcat(request, upper);
  strcat(request, bs);
  
  strcat(request, segments);
  strcat(request, bs);
  
  strcat(request,threads);
  strcat(request,bs);
  
  strcat(request,function);
  strcat(request, end);
  
  return request;
  }
  </code></pre>