libusbg: Fix readlink/buffer overrun issue. CID#56130, CID#56129

Readlink() can return the total length of the buffer (here 4096/USBG_MAX_PATH_LENGTH),
so we do not want to dereference target[4096] as that would give an off by one error.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
libusbg: Fix buffer overrun issue. CID#56128

Avoid calling usbg_read_string() with a 40 byte long buffer, which in turn is filled in
by usbg_read_buf() which uses a maximum of 256 bytes (USBG_MAX_STR_LENGTH). This adjusts
the buffer to be the right size.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
libusbg: Do not try to dereference func when it is NULL. CID#56127

We check if func is NULL, so if the allocation function failed we should
not dereference or handle it anymore, so we jump straight to the end.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
libusbg: Do not dereference usb config attributes when they are NULL. CID#56126

We probably need to check if we get valid attributes passed. Otherwise we will
try to dereference a NULL-pointer as the usb_config_attr will not be valid.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>