Skip to content

Commit

Permalink
When the value was too large, I was getting this error:
Browse files Browse the repository at this point in the history
    *** stack smashing detected ***: <unknown> terminated

Now the value is truncated when it is too large.
  • Loading branch information
adiel-mittmann committed Nov 3, 2017
1 parent bb9cfd5 commit c102546
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nvp.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ struct nvp *make_nvp(struct msg_src *src, char *s, const char *pfx)/*{{{*/
struct nvp *result;
size_t pfxlen;
char *nn, *mm, *vv;
char *vv_null_pos;

pfxlen = strlen(pfx);
if (strncasecmp(pfx, s, pfxlen))
Expand All @@ -168,6 +169,7 @@ struct nvp *make_nvp(struct msg_src *src, char *s, const char *pfx)/*{{{*/
nn = name;
mm = minor;
vv = value;
vv_null_pos = value + sizeof(value) - 1;
last_action = GOT_NOTHING;
do {
qq = *(unsigned char *) q;
Expand Down Expand Up @@ -211,6 +213,7 @@ struct nvp *make_nvp(struct msg_src *src, char *s, const char *pfx)/*{{{*/
#ifdef VERBOSE_TEST
fprintf(stderr, " COPY_TO_VALUE\n");
#endif
if (vv < vv_null_pos)
*vv++ = *q;
break;
case COPY_NOWHERE:
Expand Down

0 comments on commit c102546

Please sign in to comment.