SMS Parsing SIM900 trouble.

Hello sirs! Please help me in Parsing the sent message in my GSM SIM900A. this code I found did the parsing trick but it doesn't return the correct message. If my message contains 19 characters it only displays 12 characters if my message contains 20 it returns 15 characters. if my message contains 13 characters it does give the correct message. 13 and below characters gives out the correct message. but aside from that. It doesn't. I don't know how to go about this. I've already read so many tutorials but to no avail. please help

#include<SoftwareSerial.h>



String message;

String readSerial1()
{
    String buffer;

    while (Serial1.available())
    {
        char c = Serial1.read();
     
        buffer.concat(c);
        delay(10);
    }

    return buffer;
}


void setup()
{
    Serial.begin(19200);
    Serial1.begin(19200);
}


void loop()
{
  
  String buffer = readSerial1();

    if (buffer.startsWith("\r\n+CMT: "))
    {
               
        // Remove first 51 characters
         Serial.println(buffer);
        buffer.remove(0, 51);
        int len = buffer.length();
        // Remove \r\n from tail
        buffer.remove(len - 2, 2);
        Serial.println(len);
        Serial.println(buffer);
        Serial.println("xxxxxxxxxxxx"); 
    }

    delay(100);
   
}
    if (buffer.startsWith("\r\n+CMT: "))
    {
               
        // Remove first 51 characters
         Serial.println(buffer);
        buffer.remove(0, 51);

Even if it doesn't contain 51 characters?

    while (Serial1.available())
    {
        char c = Serial1.read();
     
        buffer.concat(c);
        delay(10);
    }

That is the stupidest way possible to "read all the data that makes up a packet". You haven't a hope in hell of reading all of one packet and nothing else.