Mercurial > hg > piper-cpp
comparison ext/sord/src/sord.c @ 266:234f89708d75
Fix strncpy overrun
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Sat, 13 Oct 2018 12:32:03 +0100 |
parents | c5cdc9e6a4bf |
children |
comparison
equal
deleted
inserted
replaced
265:7ada63fe1084 | 266:234f89708d75 |
---|---|
1069 { str, n_bytes, n_chars, flags, SERD_LITERAL }, 1, { { 0 } } | 1069 { str, n_bytes, n_chars, flags, SERD_LITERAL }, 1, { { 0 } } |
1070 }; | 1070 }; |
1071 key.meta.lit.datatype = sord_node_copy(datatype); | 1071 key.meta.lit.datatype = sord_node_copy(datatype); |
1072 memset(key.meta.lit.lang, 0, sizeof(key.meta.lit.lang)); | 1072 memset(key.meta.lit.lang, 0, sizeof(key.meta.lit.lang)); |
1073 if (lang) { | 1073 if (lang) { |
1074 strncpy(key.meta.lit.lang, lang, sizeof(key.meta.lit.lang)); | 1074 strncpy(key.meta.lit.lang, lang, sizeof(key.meta.lit.lang)-1); |
1075 } | 1075 } |
1076 | 1076 |
1077 return sord_insert_node(world, &key, true); | 1077 return sord_insert_node(world, &key, true); |
1078 } | 1078 } |
1079 | 1079 |