Fix some compilation errors with GCC 4.8
Work around a SIGSEGV

- This looks vaguely like:

    https://bugzilla.redhat.com/show_bug.cgi?id=1079788

  Work around this by extracting buffer and size, and using them
  directly.