All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] udev: Add check for serial before string operation
@ 2010-08-20  3:10 Zhenhua Zhang
  2010-08-20  8:20 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Zhenhua Zhang @ 2010-08-20  3:10 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

'serial' could be NULL in some case. So it need to add check before
doing string operation.
---
 plugins/udev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 84399de..6720a0c 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -86,7 +86,7 @@ static const char *get_serial(struct udev_device *udev_device)
 		entry = udev_list_entry_get_next(entry);
 	}
 
-	if (strpbrk(serial, ".-_?*") != NULL)
+	if (serial && strpbrk(serial, ".-_?*") != NULL)
 		return NULL;
 
 	return serial;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] udev: Add check for serial before string operation
  2010-08-20  3:10 [PATCH] udev: Add check for serial before string operation Zhenhua Zhang
@ 2010-08-20  8:20 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2010-08-20  8:20 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

Hi Zhenhua,

> 'serial' could be NULL in some case. So it need to add check before
> doing string operation.
> ---
>  plugins/udev.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/plugins/udev.c b/plugins/udev.c
> index 84399de..6720a0c 100644
> --- a/plugins/udev.c
> +++ b/plugins/udev.c
> @@ -86,7 +86,7 @@ static const char *get_serial(struct udev_device *udev_device)
>  		entry = udev_list_entry_get_next(entry);
>  	}
>  
> -	if (strpbrk(serial, ".-_?*") != NULL)
> +	if (serial && strpbrk(serial, ".-_?*") != NULL)
>  		return NULL;

and I was thinking at least one of these string functions does a correct
job, but seems no :(

Patch has been applied. Thanks.

Regards

Marcel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-20  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-20  3:10 [PATCH] udev: Add check for serial before string operation Zhenhua Zhang
2010-08-20  8:20 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.