On Wed, Jan 05, 2005 at 10:13:52PM +0200, Pekka Savola wrote: > I'd welcome more eyeballs looking at it, correct any mistakes and > omissions (if any :).
Looks good, except this bit seems dodgy:
- memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length); - ptr += CWDG(cwd).cwd_length; + *ptr++ = '\''; + while (dir_length > 0) { + switch (*dir) { + case '\'': + *ptr++ = '\''; + *ptr++ = '\\'; + *ptr++ = '\''; + /* fall-through */
Is ptr going to be big enough? For every ' character it's incremented several times.
This may become clear when more context is present, but it's the only thing that I'd be wanting to look more closely at.
Steve -
On Wed, Jan 05, 2005 at 10:13:52PM +0200, Pekka Savola wrote:
> I'd welcome more eyeballs looking at it, correct any mistakes and
> omissions (if any :).
Looks good, except this bit seems dodgy:
- memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd) .cwd_length) ; .cwd_length;
- ptr += CWDG(cwd)
+ *ptr++ = '\'';
+ while (dir_length > 0) {
+ switch (*dir) {
+ case '\'':
+ *ptr++ = '\'';
+ *ptr++ = '\\';
+ *ptr++ = '\'';
+ /* fall-through */
Is ptr going to be big enough? For every ' character it's incremented
several times.
This may become clear when more context is present, but it's the
only thing that I'd be wanting to look more closely at.
Steve
-