]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 263640 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Mon, 17 May 2010 22:10:46 +0000 (22:10 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 17 May 2010 22:10:46 +0000 (22:10 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

................
  r263640 | mmichelson | 2010-05-17 17:08:01 -0500 (Mon, 17 May 2010) | 16 lines

  Merged revisions 263639 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4

  ........
    r263639 | mmichelson | 2010-05-17 17:00:28 -0500 (Mon, 17 May 2010) | 10 lines

    Fix logic error when checking for a devstate provider.

    When using strsep, if one of the list of specified separators is not found,
    it is the first parameter to strsep which is now NULL, not the pointer returned
    by strsep.

    This issue isn't especially severe in that the worst it is likely to do is waste
    some cycles when a device with no '/' and no ':' is passed to ast_device_state.
  ........
................

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@263642 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/devicestate.c

index 83cbbb7b40b3441338dce713eaf2cd730892339e..49b7e1efc391ea7c9c4788f8466a1fe769f487d9 100644 (file)
@@ -327,8 +327,10 @@ static enum ast_device_state _ast_device_state(const char *device, int check_cac
        buf = ast_strdupa(device);
        tech = strsep(&buf, "/");
        if (!(number = buf)) {
-               if (!(provider = strsep(&tech, ":")))
+               provider = strsep(&tech, ":");
+               if (!tech) {
                        return AST_DEVICE_INVALID;
+               }
                /* We have a provider */
                number = tech;
                tech = NULL;