the method to get nlmsg_len in audit_send() is error
Hello Steve,
I think micro NLMSG_ALIGN is needless for nlmsg_len, NLMSG_SPACE is sufficient. because NLMSG_SPACE includes the rounded netlink header size.
Now no errors occurred because struct req has been set to all 0.
Signed-off-by Yu Zhiguo<[email protected]>
--- lib/netlink.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib/netlink.c +1 -1
@@ -220,7 +220,7 @@ int audit_send(int fd, int type, const void *data, unsigned int size) sequence =1 ;memset (&req,0 ,sizeof (req)); - req.nlh.nlmsg_len =NLMSG_ALIGN (req.nlh.nlmsg_len) +NLMSG_SPACE (size); + req.nlh.nlmsg_len =NLMSG_SPACE (size); req.nlh.nlmsg_type = type; req.nlh.nlmsg_flags =NLM_F_REQUEST |NLM_F_ACK ; req.nlh.nlmsg_seq = sequence;
Steve Grubb
AppliedQuoted 2 lines · On Monday 28 July 2008 05:02:53 Yu Zhiguo wrote:
I think micro
NLMSG_ALIGNis needless fornlmsg_len,NLMSG_SPACEis sufficient. becauseNLMSG_SPACEincludes the rounded netlink header size.
I guess you are right. I checked the macros just be sure since this is some of the oldest code in the audit project and hasn't changed in a very long time.
Applied. Thanks for the patch.
-Steve