code: def _decode_string(buf, pos):
      
      for i in range(pos, len(buf)):
          if buf[i:i+1] == _compat_bytes('\x00'):
              try:
                  return (buf[pos:i].decode(_CHARSET), i+1)
              # Uncomment the following two lines for detailled information
              #except UnicodeDecodeError as ude:
              #   raise MinusconfError(str(ude))
              except UnicodeDecodeError:
                  raise MinusconfError('Not a valid ' + _CHARSET + ' string: ' + repr(buf[pos:i]))
  
      raise MinusconfError("Premature end of string (Forgot trailing \\0?), buf=" + repr(buf))
docs: Decodes a string in the buffer buf, starting at position pos.
      Returns a tupel of the read string and the next byte to read.