use strnlen in sg_lupdate_string

  if no strnlen is provided, use own one
move SG_LUPDATE_IF do to where it's used

  .. and copy all of the source, not only length-1 ;)