All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenhua Zhang <zhenhua.zhang@intel.com>
To: ofono@ofono.org
Subject: [PATCH] udev: Add check for serial before string operation
Date: Fri, 20 Aug 2010 11:10:39 +0800	[thread overview]
Message-ID: <1282273839-4990-1-git-send-email-zhenhua.zhang@intel.com> (raw)

[-- 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


             reply	other threads:[~2010-08-20  3:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  3:10 Zhenhua Zhang [this message]
2010-08-20  8:20 ` [PATCH] udev: Add check for serial before string operation Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282273839-4990-1-git-send-email-zhenhua.zhang@intel.com \
    --to=zhenhua.zhang@intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.