Closed JanCybulski closed 9 years ago
I'm against such checks. If caller passes null as argument, it should crash. The rest of libsmack doesn't check function arguments for null pointers. Exactly the same behaviour is provided by several other low-level libraries, like libc.
I would suggest that libsmack is a little higher level than libraries like libc. I would recommend we actually check for null pointers. If you check for it and return an error instead of just crashing, the caller has a chance to be able to do something intelligent about it. If you just null-pointer dereference, the caller can't have the opportunity to do anything intelligent or robust.
That said, I'm sure the maintainer will make an appropriate decision.
multiplying tests consumes to much power just leaving the caller be right is enough
That said, I'm sure the maintainer will make an appropriate decision.
Actually: I originally had another idea: instead of just returning -1 libsmack could just return lenght of label. This might be a little helpful sometimes: when you need to know what is the length and do not need label itself.
This kind of behaviour is useful when the client allocates the buffer but it is not the case here then I'm sceptical about the real interest.
Yes, I understand this, and I think, that it would be good if libsmack provided api for storing label in user buffer. Nevertheless There is no such api now, so you are absolutely right.
Ok, I think there is no will of mergint this. l will close this.
Check input pointer parameter of smack_new_label_from* functions
Signed-off-by: Jan Cybulski j.cybulski@samsung.com