Sizeof issues in buffer

I have the following code that is bring am mqtt code to manipiulate, but the last parameter is empty

void mqttMessageReceived(String &topic, String &payload) {

  DPRINT("Received Topic: ["); DPRINT(topic); DPRINT("] Payload: "); DPRINTLN(payload);
  DPRINTLN(topic); 
//  char buf[32];
  char buf[sizeof(topic)];
  topic.toCharArray(buf, sizeof(buf));
  DPRINT("273 ");DPRINTLN(topic);

  char *p = strtok(buf, "/");
  DPRINT("276 ");DPRINTLN(buf);

  p = strtok(0, "/");
  if (p == NULL)
    return;
  strcpy(&destinationDeviceAddress[0], p);
  DPRINT("282 ");DPRINTLN(destinationDeviceAddress);

  p = strtok(0, "/");
  DPRINT("285 ");DPRINTLN(p);
  if (p == NULL)
    return;
  strcpy(&destinationDevicePropery[0], p);
  DPRINT("288 ");DPRINTLN(destinationDevicePropery);

  payload.toCharArray(destinationValue, sizeof(payload));

  routeOutgoingMessage = true;
}

The monitor shows this
Received Topic: [TheShop/ab/heat] Payload: 1
TheShop/ab/heat
273 TheShop/ab/heat
276 TheShop
282 ab
285
If i change char buf[sizeof(topic)]; to char buf[32]; the result becomes
TheShop/ab/heat
273 TheShop/ab/heat
276 TheShop
282 ab
285 heat
288 heat

Any suggestions?

sizeof(topic) does NOT tell you the length of the string stored in topic is. It tells you the size of the String object named topic. topic.length() tells you the length of the string.

String.length() doesn't include space for a null terminator so try:
char buf[topic.length()+1];

That worked. Thank you