#289 new
xdeng

当plist里有两个key时会报错

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

..............
<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));

}

Comments and changes to this ticket

  • China-Akk
  • Nikias Bassen

    Nikias Bassen November 8th, 2012 @ 09:32 PM

    • 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().

  • Yin Dian

    Yin Dian November 9th, 2012 @ 02:20 AM

    Seems similar problem to #226, but #226 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.

  • xdeng

    xdeng November 9th, 2012 @ 06:29 AM

    I'm sorry I only speak a little English

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

  • China-Akk

    China-Akk February 12th, 2013 @ 10:48 AM

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

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

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

    发包的长度错误 我气死了

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

A project around supporting the iPhone in Linux.

See http://libimobiledevice.org

People watching this ticket

Attachments

Tags

Pages