Tirsdag den 6. januar 2004 02:35 skrev du: > -----BEGIN PGP SIGNED MESSAGE----- > > > --- snip > > argBuf = xmalloc ( strlen(p->key) + > > strlen(type_stat) + > > strlen(tag_stat) + > > strlen(li->rev_old) + 2); > > I'd suggest at least + 4 (the characters ':' + ':' + ':' + '\0' need to > be accounted) rather than + 2. I would probably write it as >
Yep/Thanx!! I also discovered + corrected the problem, and my page has been updated. > size_t buflen, bufresult; > ... > > buflen = strlen(p->key) + 1 /* ':' */ + > strlen(type_stat) + 1 /* ':' */ + > strlen(tag_stat) + 1 /* ':' */ + > strlen(li->rev_old) + 1 /* '\0' */ > > argBuf = xmalloc ( buflen ); > bufresult = snprintf (argBuf, buflen, "%s:%s:%s:%s", > p->key, type_stat, tag_stat, li->rev_old); > if (bufresult > buflen) If this 'if' is true, wouldn't you say that we have a problem with wrong/bad terminated strings anyway, and that this would lead to a xmalloc/realloc-problem and -errormessage some time after all? I mean, how much is 'to much' e.g. (buflen-bufresult)>PATH_MAX is probably a bad sign? (PATH_MAX just chosen since its a resonable big number). BR, Claus (I wonder how people can sell proprietary cm-solutions, when you know that corrections to the their code will probably never will be discussed openly/thoroughly enough like CVS corrections are discussed here in this info-list.) _______________________________________________ Info-cvs mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/info-cvs
