Nokia LCD display shield question

I have simplified one of the functions from my my MP3 Player. This basically displays data from a string which you supply, scrolling it around by 1 character each time the function is called.

//Scroll through songInfo, shifting 1 characters each time
void printScroll(char* songInfo, byte infoLength, boolean start = false);
void printScroll(char* songInfo, byte infoLength, boolean start){
  static unsigned int tagPosition = 0;
  if(start){
    tagPosition = 0;
  }
  
  char stringRecover[23] = {0};
  strncpy(stringRecover,&songInfo[tagPosition], 22); //22 character substring starting at [tagPosition]
  
  graphic.setCoordinate(0,70);
  graphic.print(stringRecover);
  
  tagPosition += 1;
  if (tagPosition >= infoLength - 21){ //subtracting 21 as the last 21 characters are the same as the first. 
    tagPosition = 0;
  }
}

The function does not check the length of the string you supply (I took too much time for my particular project), so you need to ensure that the string is at least 43 characters long, and that the last 21 characters are the same as the first. For example:

"Hello, this string is more than 22 characters longHello, this string is"; //Noting that the last 21 characters are the same as the first.
"Hello, Hello, "; //This string is padded with spaces to ensure that it is the correct length.

You could use something like this function to automatically format the string and scroll it:

....
  //This code calls the scroll funtion
  char string[] = "Hello, this is the string I wan't to scroll around the screen";
  scrollString(string, 50); //scroll the string 50 places to the right (will loop around as necessary).

...

void scrollString(char* suppliedString, byte n){ //Formats then scrolls the string around the screen n times.
  int length = strlen(suppliedString);

  char string[length < 22? 44: length + 22];  //create a longer buffer of minimum size 44 characters (22 + 21 + null).

  strcpy(string, suppliedString); //Copy the supplied string into the new buffer

  //check the length of the string:
  if (length < 22){
    //String is too short!
    memset(string + length, ' ', 22 - length); //so pad with spaces up to the required length
    string[22] = 0; //re null terminate (we just overwrote the null with a ' ')
    length = 22; //string is now 22 characters long
  }
  
  //Now append the first 21 characters to the end to allow wrap around (so the string can scroll around the screen continuously)
  char stringRecover[22] = {0};
  strncpy(stringRecover,string,21);
  sprintf(string + length,"%s",stringRecover); //Add the first 21 chars onto the end of songInfo to make it easier to loop through later

  length = strlen(string);
  printScroll(string, length, true); //initial print to the screen, reset loop position to the start.

  for (byte i = 0; i < n - 1; i++){
     printScroll(string, length); //shift around the screen n times.
  }
}

(Just to note, the formatting function hasn't been tested beyond it compiling as I don't have a screen to hand, but I know the printing function works).