Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jan 2011 17:17:37 +0000 (UTC)
From:      David Malone <dwmalone@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/usr.sbin/syslogd syslogd.c
Message-ID:  <201101191717.p0JHHm68003545@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
dwmalone    2011-01-19 17:17:37 UTC

  FreeBSD src repository

  Modified files:
    usr.sbin/syslogd     syslogd.c 
  Log:
  SVN rev 217589 on 2011-01-19 17:17:37Z by dwmalone
  
  Here v->iov_len has been assigned the return value from snprintf.
  Checking if it is > 0 doesn't make sense, because snprintf returns
  how much space is needed if the buffer is too small. Instead, check
  if the return value was greater than the buffer size, and truncate
  the message if it was too long.
  
  It isn't clear if snprintf can return a negative value in the case
  of an error - I don't believe it can. If it can, then testing
  v->iov_len won't help 'cos it is a size_t, not an ssize_t.
  
  Also, as clang points out, we must always increment v here, because
  later code depends on the message being in iov[5].
  
  Revision  Changes    Path
  1.168     +3 -2      src/usr.sbin/syslogd/syslogd.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101191717.p0JHHm68003545>