Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

当plist里有两个key时会报错

#289
..............
<key>SequenceNumber</key>
<integer>156</integer>
<key>CFBundleDisplayName</key>
<key>CFBundleDisplayName</key>
<key>Container</key>
<string>/private/var/mobile/Applications/C2ED8101-C404-491F-BEA3-D4B4B55EBC85</string>
.................

当想要获取CFBundleDisplayName的string时 调用plist_get_string_val会报错 因为有连续的两个key。 需要在调用plist_get_string_val之前判断node的类型是否为string然后再调用 plist_get_node_type返回的是PLIST_KEY

但是源码里面有判断node的类型,为什么还会报错?
void plist_get_string_val(plist_t node, char **val)
{

plist_type type = plist_get_node_type(node);
uint64_t length = 0;
if (PLIST_STRING == type)
    plist_get_type_and_value(node, &type, (void *) val, &length);
assert(length == strlen(*val));

}

Reported by xdeng · September 29th, 2012 @ 04:58 AM

State: new
Milestone: none
Assigned to: nobody

Activity

  1. China-Akk
  2. Nikias Bassen
    Nikias Bassen
    • Tag set to libplist

    Reporting in english would be helpful :D Where did you get this property list from? Looks like an invalid plist. To get the name of a node use plist_get_key_val().

    November 8th, 2012 @ 09:32 PM

  3. Yin Dian
    Yin Dian

    Seems similar problem to #226 libplist++ crashes when handling dictionary with adjacent key nodes, but #226 libplist++ crashes when handling dictionary with adjacent key nodes is for plist++. plist library itself should work if using properly.

    Although the input plist seems invalid, the library shall be tolerant as adjacent key nodes do exist in real life and stock applications.

    November 9th, 2012 @ 02:20 AM

  4. xdeng
    xdeng

    I'm sorry I only speak a little English

    确实是有这样的一个plist文件,是一个软件应用ipa包里面的的,itunes是能够安装的,能识别的。现在找不到那个ipa包了

    November 9th, 2012 @ 06:29 AM

  5. China-Akk
    China-Akk

    类型不对会报错 idevicedate.c那里面有个获取时间的类型换成plist_get_real_val(node, &datetime); 就不会报错了
    奇怪 我以前编译的或死后怎么不会报错呢

    搞这个驱动遇到了很多问题

    结果我的 afc.c 里面的函数使用都不正常

    发包的长度错误 我气死了

    February 12th, 2013 @ 10:48 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.