Skip to content

Commit 0836119

Browse files
committed
make cpplint happy
1 parent 73aacea commit 0836119

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pandas/_libs/src/ujson/lib/ultrajsondec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ JSOBJ JSON_DecodeObject(JSONObjectDecoder *dec, const char *buffer,
11841184
if (origLocale == NULL) {
11851185
return SetError(&ds, -1, "Could not reserve memory block");
11861186
}
1187-
strncpy(origLocale, locale, len);
1187+
snprintf(origLocale, len, "%s", locale);
11881188
setlocale(LC_NUMERIC, "C");
11891189
ret = decode_any(&ds);
11901190
setlocale(LC_NUMERIC, origLocale);

pandas/_libs/src/ujson/lib/ultrajsonenc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,13 +1182,13 @@ char *JSON_EncodeObject(JSOBJ obj, JSONObjectEncoder *enc, char *_buffer,
11821182
}
11831183

11841184
if (strcmp(locale, "C")) {
1185-
int len = strlen(locale) + 1;
1185+
int len = malloc(strlen(locale) + 1);
11861186
char *origLocale = malloc(len);
11871187
if (origLocale == NULL) {
11881188
SetError(NULL, enc, "Could not reserve memory block");
11891189
return NULL;
11901190
}
1191-
strncpy(origLocale, locale, len);
1191+
snprintf(origLocale, len, "%s", locale);
11921192
setlocale(LC_NUMERIC, "C");
11931193
encode(obj, enc, NULL, 0);
11941194
setlocale(LC_NUMERIC, origLocale);

0 commit comments

Comments
 (0)