Skip to content

Commit 41ad148

Browse files
Merge branch 'mysql-5.6' into mysql-5.7
2 parents fe93770 + b20487a commit 41ad148

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

libmysql/conf_to_src.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -118,7 +118,7 @@ print_arrays_for(char *set)
118118
{
119119
FILE *f;
120120

121-
sprintf(buf, "%s.conf", set);
121+
snprintf(buf, sizeof(buf), "%s.conf", set);
122122

123123
if ((f = fopen(buf, "r")) == NULL) {
124124
fprintf(stderr, "%s: can't read conf file for charset %s\n", prog, set);

regex/main.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern void regprint(my_regex_t *r, FILE *d);
2626

2727

2828
#ifdef _WIN32
29+
#define snprintf _snprintf
2930
char *optarg= "";
3031
int optind= 1;
3132
int opterr;
@@ -501,7 +502,8 @@ char *should;
501502
(sub.rm_so != -1 && sub.rm_eo == -1) ||
502503
(sub.rm_so != -1 && sub.rm_so < 0) ||
503504
(sub.rm_eo != -1 && sub.rm_eo < 0) ) {
504-
sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
505+
snprintf(grump, sizeof(grump),
506+
"start %ld end %ld", (long)sub.rm_so,
505507
(long)sub.rm_eo);
506508
return(grump);
507509
}
@@ -514,7 +516,8 @@ char *should;
514516

515517
/* check for in range */
516518
if ((int) sub.rm_eo > (int) strlen(str)) {
517-
sprintf(grump, "start %ld end %ld, past end of string",
519+
snprintf(grump, sizeof(grump),
520+
"start %ld end %ld, past end of string",
518521
(long)sub.rm_so, (long)sub.rm_eo);
519522
return(grump);
520523
}
@@ -525,13 +528,13 @@ char *should;
525528

526529
/* check for not supposed to match */
527530
if (should == NULL) {
528-
sprintf(grump, "matched `%.*s'", (int)len, p);
531+
snprintf(grump, sizeof(grump), "matched `%.*s'", (int)len, p);
529532
return(grump);
530533
}
531534

532535
/* check for wrong match */
533536
if (len != shlen || strncmp(p, should, shlen) != 0) {
534-
sprintf(grump, "matched `%.*s' instead", (int)len, p);
537+
snprintf(grump, sizeof(grump), "matched `%.*s' instead", (int)len, p);
535538
return(grump);
536539
}
537540
if (shlen > 0)
@@ -544,7 +547,8 @@ char *should;
544547
if (shlen == 0)
545548
shlen = 1; /* force check for end-of-string */
546549
if (strncmp(p, at, shlen) != 0) {
547-
sprintf(grump, "matched null at `%.20s'", p);
550+
snprintf(grump, sizeof(grump),
551+
"matched null at `%.20s'", p);
548552
return(grump);
549553
}
550554
return(NULL);
@@ -577,7 +581,7 @@ char *name;
577581
static char efbuf[100];
578582
my_regex_t re;
579583

580-
sprintf(efbuf, "MY_REG_%s", name);
584+
snprintf(efbuf, sizeof(efbuf), "MY_REG_%s", name);
581585
assert(strlen(efbuf) < sizeof(efbuf));
582586
re.re_endp = efbuf;
583587
(void) my_regerror(MY_REG_ATOI, &re, efbuf, sizeof(efbuf));

0 commit comments

Comments
 (0)