« Previous | Next » 

Revision 3178e275

ID3178e2755ec5a7fb1afe583fb6ac2622c2c42184

Added by Jim Meyering over 11 years ago

sheepdog: avoid a few buffer overruns

  • parse_vdiname: Use pstrcpy, not strncpy, when the destination
    buffer must be NUL-terminated.
  • sd_open: Likewise, avoid buffer overrun.
  • do_sd_create: Likewise. Leave the preceding memset, since
    pstrcpy does not NUL-fill, and filename needs that.
  • sd_snapshot_create: Add a comment/question.
  • find_vdi_name: Remove a useless memset.
  • sd_snapshot_goto: Remove a useless memset.
    Use pstrcpy to NUL-terminate, because find_vdi_name requires
    that its vdi arg (filename parameter) be NUL-terminated.
    It seems ok not to NUL-fill the buffer.
    Do the same for snapid: remove useless memset-0 (instead,
    zero tag0). Use pstrcpy, not strncpy.
  • sd_snapshot_list: Use pstrcpy, not strncpy to write
    into the ->name member. Each must be NUL-terminated.

Acked-by: Kevin Wolf <>
Acked-by: MORITA Kazutaka <>
Signed-off-by: Jim Meyering <>
Signed-off-by: Anthony Liguori <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences