Re: Displaying structure members named like C keywords.

2014-08-21 Thread Sergio Durigan Junior
On Thursday, August 21 2014, Emilio Lopes wrote:

>> I could not reproduce the problem here.  Would you mind providing the
>> structure declaration, or at least a reproducer?
>
> Hello Sergio,
>
> thank you very much for your prompt answer!
>
> Here is the declaration of the structure:

Thanks, Emilio.

I am still not able to reproduce it here, using git HEAD or grabbing
7.8's source.  Would it be possible for you to come up with a simpler
reproducer and send it to this list?  I am guessing there is something
else in your code that might be triggering this.

Thanks,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb


Re: Displaying structure members named like C keywords.

2014-08-21 Thread Emilio Lopes
> I could not reproduce the problem here.  Would you mind providing the
> structure declaration, or at least a reproducer?

Hello Sergio,

thank you very much for your prompt answer!

Here is the declaration of the structure:

  typedef struct param_t {
const char*  name;
type_t type;
short not_available : 1;
short rlevel : 4;
short wlevel : 4;
union {
  struct {
void* get_fct;
void* set_fct;
void* gsv_fct;
int32_t polling_default;
int32_t polling_min;
  } natural;
  struct {
unsigned short paramc;
struct param_t* paramv;
  } complex;
  struct {
void (*cmd_fct)();
void (*wrap)(void (*cmd_fct)(), p_id cmd, const variant_t*
argv, size_t argc, variant_t* res);
  } cmd;
  struct {
type_t type;
struct param_t *link;
  } alias;
} info;
struct param_t* parent;
void* user_data;
  } param_t;

  extern param_t* const g_global_paramv;

Regards

 Emílio

___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb


Re: Displaying structure members named like C keywords.

2014-08-21 Thread Sergio Durigan Junior
On Thursday, August 21 2014, Emilio Lopes wrote:

> I'm having trouble trying to display structure members with names like
> C keywords.  GDB refuses to display the member called `complex' in
> this case.

Hello Emilio,

> Here is the structure:
>
> (gdb) p g_global_paramv[37].info
> $27 = {
>   complex = {
> paramc = 20,
> paramv = 0xd14f4 <_sys_opt>
>   },
>   cmd = {
> cmd_fct = 0x14,
> wrap = 0xd14f4 <_sys_opt>
>   },
>   alias = {
> type = 20,
> link = 0xd14f4 <_sys_opt>
>   }
> }

I could not reproduce the problem here.  Would you mind providing the
structure declaration, or at least a reproducer?

Thanks,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb


Re: Potential vulnerabilities in GDB 7.8

2014-08-21 Thread Sergio Durigan Junior
On Wednesday, August 20 2014, Hádrian R wrote:

> Hi, I'm Kaiwaiata​​, since more than 2h searching and finding various
> possible vulnerabilities in source code of GDB..
> I will tell you one vulnerability now, if they treat me well I will tell
> the other..

Hello Kaiwaiata,

Thanks for the message.  However, this list is not used by GDB folks
anymore.  I recommend you to post your message on .

> unsafe use of *strcpy()* in *int net_open (.. ..){**:*
>
> *gdb-7.8.tar\gdb\ser-tcp.c:*
> *line 187: *strncpy (hostname, name, tmp);
> *line 187: *strcpy (hostname, "localhost");

You could even post a patch fixing this, if you want.  To do that, send
the patch to .

Thanks,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb


Displaying structure members named like C keywords.

2014-08-21 Thread Emilio Lopes
I'm having trouble trying to display structure members with names like
C keywords.  GDB refuses to display the member called `complex' in
this case.

Here is the structure:

(gdb) p g_global_paramv[37].info
$27 = {
  complex = {
paramc = 20,
paramv = 0xd14f4 <_sys_opt>
  },
  cmd = {
cmd_fct = 0x14,
wrap = 0xd14f4 <_sys_opt>
  },
  alias = {
type = 20,
link = 0xd14f4 <_sys_opt>
  }
}

Printing other members is no problem:

(gdb) p g_global_paramv[37].info.cmd
$28 = {
  cmd_fct = 0x14,
  wrap = 0xd14f4 <_sys_opt>
}
(gdb) p g_global_paramv[37].info.alias
$29 = {
  type = 20,
  link = 0xd14f4 <_sys_opt>
}

But trying to print the member `complex' results in an error:

(gdb) p g_global_paramv[37].info.complex
A syntax error in expression, near `complex'.

Note that the error message for non-existing members is different
depending if their names are C keywords (`long' and `int' => "syntax
error") or not (`foobar', `xyz' => "no member named ...").

(gdb) p g_global_paramv[37].info.foobar
There is no member named foobar.
(gdb) p g_global_paramv[37].info.long
A syntax error in expression, near `long'.
(gdb) p g_global_paramv[37].info.int
A syntax error in expression, near `int'.
(gdb) p g_global_paramv[37].info.xyz
There is no member named xyz.
(gdb)

This happens using gdb-7.8 configured as following:

(gdb) show version
GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu
--target=arm-cortexa8-linux-gnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) show configuration
This GDB was configured as follows:
   configure --host=x86_64-unknown-linux-gnu
--target=arm-cortexa8-linux-gnueabi
 --with-auto-load-dir=$debugdir:$datadir/auto-load
 --with-auto-load-safe-path=$debugdir:$datadir/auto-load
 --with-expat
 --with-gdb-datadir=/usr/local/share/gdb (relocatable)
 --with-jit-reader-dir=/usr/local/lib/gdb (relocatable)
 --without-libunwind-ia64
 --with-lzma
 --with-python=/usr
 --without-guile
 --with-separate-debug-dir=/usr/local/lib/debug (relocatable)
 --with-zlib
 --without-babeltrace

("Relocatable" means the directory can be moved with the GDB installation
tree, and GDB will still find it.)

The code was compiled using:

$ arm-cortexa8-linux-gnueabi-gcc --version
arm-cortexa8-linux-gnueabi-gcc (OSELAS.Toolchain-2012.12.1
linaro-4.7-2012.11) 4.7.3 20121106 (prerelease)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GDB itself was compiled with:

$ gcc --version
gcc (Debian 4.9.0-7) 4.9.0
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thank you very much!

 Emílio

___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb


Potential vulnerabilities in GDB 7.8

2014-08-21 Thread Hádrian R
Hi, I'm Kaiwaiata​​, since more than 2h searching and finding various
possible vulnerabilities in source code of GDB..
I will tell you one vulnerability now, if they treat me well I will tell
the other..

foolish or important things?

unsafe use of *strcpy()* in *int net_open (.. ..){**:*

*gdb-7.8.tar\gdb\ser-tcp.c:*
*line 187: *strncpy (hostname, name, tmp);
*line 187: *strcpy (hostname, "localhost");

*#* if an attacker manages to take control of *hostname[100];*, may cause a
buffer overflow.

*NOTE*: is likely to be directed toward *.bss,* also be a vulnerability

i hope answer, thanks a lot!,
Kaiwaiata - HádrienR.
___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb