diff --git a/nvp.c b/nvp.c index 04e2087..81aef8f 100644 --- a/nvp.c +++ b/nvp.c @@ -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)) @@ -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; @@ -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: