[PD-dev] [ pure-data-Patches-1836228 ] [patch] simplify pd_makeversion() in src/s_main.c

SourceForge.net noreply at sourceforge.net
Sun Jan 6 05:29:52 CET 2008


Patches item #1836228, was opened at 2007-11-21 22:37
Message generated for change (Comment added) made by russellbryant
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1836228&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Russell Bryant (russellbryant)
Assigned to: Miller Puckette (millerpuckette)
Summary: [patch] simplify pd_makeversion() in src/s_main.c

Initial Comment:
This minor patch simplifies the pd_makeversion() function in src/s_main.c.

It replaces the sprintf / malloc / strcpy, with the equivalent single call to asprintf.  It also provides the side benefit of removing the length limitation introduced by the intermediary stack buffer (with bounds that weren't being checked).


----------------------------------------------------------------------

>Comment By: Russell Bryant (russellbryant)
Date: 2008-01-05 22:29

Message:
Logged In: YES 
user_id=1942915
Originator: YES

Actually, I mean sprintf to snprintf.  Anyway, here is an updated patch
that includes the change from sprintf to snprintf, as well as a
simplification to use strdup() instead of malloc/strcpy.

----------------------------------------------------------------------

Comment By: Russell Bryant (russellbryant)
Date: 2008-01-05 22:26

Message:
Logged In: YES 
user_id=1942915
Originator: YES

Well, it turns out that asprintf() is a GNU extension, and is not a part
of standard C or POSIX.  So, this probably will not be acceptable. 
However, I'd like to still leave it open, as I'd like to see the strcpy
changed to strncpy ...

----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2007-11-23 13:24

Message:
Logged In: YES 
user_id=27104
Originator: NO


Funny, I originally submitted the patch with this function and it included
asprintf().  Miller accepted the patch, but replaced the asprintf() with
the sprintf/malloc/strcpy combo, with only this comment:

"modified to avoid the effete asprintf() call, then took for 0.40"

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1836228&group_id=55736




More information about the Pd-dev mailing list