Getting weird characters/symbols at the end

#include <RH_ASK.h> //Transmitter
#include <SPI.h>

float fsrAnalogPin = 2;
float force1;

char stri1[]="    ";

char buf[sizeof(stri1)+ 2];

RH_ASK driver(2000, 4, 3, 10);

void setup() {

  Serial.begin(9600);
  if(!driver.init())
    Serial.println("init failed");
    
}

void loop()
{
char stri1[]="   ";
  
  force1 = analogRead(fsrAnalogPin);
  dtostrf(force1,0,0,stri1);
#include <RH_ASK.h> //receiver


RH_ASK driver(2000, 4, 3, 10);

void setup()
{
  Serial.begin(9600);
  if(!driver.init())
    Serial.println("no radio");
    
}


void loop()
{
    uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
    uint8_t buflen = sizeof(buf);

    if (driver.recv(buf,&buflen))
    {
      Serial.print("Received ");
      Serial.println((char*)buf);
      
    }
}

RadioHead does not automatically append the required terminating zero of a character string upon reception.

You have to make sure that there is one. One approach is as follows.

    if (driver.recv(buf,&buflen))
    {
      buf[buflen-1]=0;  //terminate character string.
     Serial.print("Received ");
      Serial.println((char*)buf);

As an aside, sending integer sensor data as formatted float strings is not a great idea. Send the integer instead, using itoa(), or even as binary.

That is going to overwrite the last byte received. Better to:

uint8_t buflen = sizeof(buf) - 1; // Reserve the last byte
...
buf[buflen] = 0;  //terminate character string.

That requires the receiving code to discard transmitted data in excess of "buflen", and it still allows for junk data to follow a shorter transmission.

The best approach for character data, is to send the terminating zero in the first place, or have transmitter and receiver agree on a protocol to add it as required. But the OP failed to post all of the transmit code.

Even better: don't send variable length character data at all. Send the binary data values, as suggested earlier.

https://www.airspayce.com/mikem/arduino/RadioHead/classRH__ASK.html#ac98869396b26c95d888234c8a0dd0ae6

'bufflen' is passed by reference so driver.recv() can fill it in with the number of bytes actually received. Decrementing before passing in the buffer length keeps .recv() from filling in the last byte of the buffer. buf[buflen] is the next available byte in the buffer after the received data.

Neither approach solves the fundamental problem associated with transmitting variable length character strings.

Sending the zero byte, as suggested earlier, does solve it.

Thanks for the help it worked!
I have added a DHT11 sensor and tried sending data reading along the FSR but noticed the values are shifting around. What am i doing wrong here?

Transmitter

#include <RH_ASK.h> //transmitter
#include <SPI.h>
#include <dht.h>
#define dht_apin A6
float fsrAnalogPin = 2;
float force1;
dht DHT;

char stri1[]="    ";

char stri2[]="    ";

char stri3[]="    ";

char buf[sizeof(stri1)+ sizeof(stri2) + sizeof(stri3) + 2];

RH_ASK driver(2000, 4, 3, 10);

void setup() {

  Serial.begin(9600);
  if(!driver.init())
    Serial.println("init failed");
    
}

void loop()
{
char stri1[]="   ";

  DHT.read11(dht_apin);
  
  force1 = analogRead(fsrAnalogPin);
  dtostrf(force1,0,0,stri1);

  dtostrf(DHT.humidity, 0,0,stri2);
  dtostrf(DHT.temperature, 0,0,stri3);
  
  
  
  Serial.print("Force 1:  ");
  Serial.println(stri1);
  Serial.print("Humidity: ");
  Serial.print(DHT.humidity);
  Serial.print("% ");
  Serial.print("Temperature: ");
  Serial.print(DHT.temperature);
  Serial.println("C  ");
  

  
  sprintf(buf, "%s %s %s ", stri1, stri2, stri3);

  driver.send((uint8_t*)buf,strlen(buf));
  driver.waitPacketSent();
  delay(2000);
}

Receiver

#include <RH_ASK.h>
char buff[]="                                                                             ";


RH_ASK driver(2000, 4, 3, 10);

void setup()
{
  Serial.begin(9600);
  if(!driver.init())
    Serial.println("no radio");
    
}


void loop()
{
    uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
    uint8_t buflen = sizeof(buf);
    

    if (driver.recv(buf,&buflen))
    {
      buf[buflen-1]=0;
      char buff[]="                      ";
      char pressure1[]="  ";//force sensor 1
      char humi[]="  ";//Humidity sensor data
      char temp[]="  ";//temperature 0
      int posi=0;
      
      for (int b=0; b<buflen; b++)
      buff[b]=char(buf[b]);
      pressure1[0]=buff[posi];
      pressure1[1]=buff[posi+1];
      pressure1[2]=buff[posi+2];
      pressure1[3]=buff[posi+3];
      int pres1 = atoi(pressure1);
      
      if((pres1>=0)&&(pres1<=9)){
        posi=posi+2;
      }
      else{
        posi=posi+3;
      }
      humi[0]=buff[posi];
      humi[1]=buff[posi+1];
      int humidity = atoi(humi);
      
      if((humidity>=0)&&(humidity<=9)){
        posi=posi+2;
      }
      else{
        posi=posi+3;
      }
      
      temp[0]=buff[posi];
      temp[1]=buff[posi+1];
      int tempera0= atoi(temp); 
      if((tempera0>=0)&&(tempera0<=9)){
        posi=posi+2;
      }
      else{
        posi=posi+3;
      }

      Serial.print("Force 1: ");
      Serial.println(pres1);
      Serial.print("Humidity: ");
      Serial.print(humidity);
      Serial.print("% ");
      Serial.print("temperature: ");
      Serial.print(tempera0);
      Serial.println("C ");

    }
}

Serial Monitor