km4arr / openpgm

Automatically exported from code.google.com/p/openpgm
0 stars 0 forks source link

pgm_gsi_create_from_string does not behave according to documentation #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
 -- Create GSI with pgm_gsi_create_from_string

What is the expected output? What do you see instead?
 -- According to the documentation, it should be possible to call it with a const char* null-terminated string and length 0, but my program asserts on "(pgm_gsi_create_from_data): assertion `length > 1' failed"

What version of the product are you using? On what operating system?
pgm 5.1 official Ubuntu repository

Original issue reported on code.google.com by mvergouw...@gmail.com on 18 Nov 2013 at 9:43

GoogleCodeExporter commented 9 years ago
Good catch, probably not a great source of entropy for a GSI though as the MD5 
of a null buffer is clearly null.  Do you suggest altering the documentation or 
permitting weak GSI?

Original comment by fnjo...@gmail.com on 30 Jan 2014 at 12:58

GoogleCodeExporter commented 9 years ago
The problem is not the null-buffer, it should never be null. It's the fact
that when you provide a const char* null-terminated string but don't
provide the length of the string either the function itself should fallback
to using strnlen or you should update the documentation and the caller
should provide the length of the string (that is what I do now).

2014-01-30 <openpgm@googlecode.com>

Original comment by mvergouw...@gmail.com on 30 Jan 2014 at 8:13

GoogleCodeExporter commented 9 years ago
If you provide the length as -1 it will calculate the string length for you.  
The only invalid value for length is 0.

Original comment by fnjo...@gmail.com on 30 Jan 2014 at 12:00

GoogleCodeExporter commented 9 years ago
Please update the documentation then.
https://code.google.com/p/openpgm/wiki/OpenPgm5CReferencePgmGsiCreateFromString

2014-01-30 <openpgm@googlecode.com>

Original comment by mvergouw...@gmail.com on 30 Jan 2014 at 12:12

GoogleCodeExporter commented 9 years ago
Fixed, had to confirm what standard glib was using.  c.f.

https://developer.gnome.org/glib/2.38/glib-File-Utilities.html#g-file-set-conten
ts

Original comment by fnjo...@gmail.com on 30 Jan 2014 at 3:46