submodule: ensure that -c http.extraheader is heeded
[gitweb.git] / sideband.c
index 7f9dc229fbc82d005b5c2b417c2af2fc9f6b497a..fde8adc000f3167bba7fdf2d7cb3a4e7db612af4 100644 (file)
@@ -137,11 +137,11 @@ ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet
                if (packet_max - 5 < n)
                        n = packet_max - 5;
                if (0 <= band) {
-                       sprintf(hdr, "%04x", n + 5);
+                       xsnprintf(hdr, sizeof(hdr), "%04x", n + 5);
                        hdr[4] = band;
                        write_or_die(fd, hdr, 5);
                } else {
-                       sprintf(hdr, "%04x", n + 4);
+                       xsnprintf(hdr, sizeof(hdr), "%04x", n + 4);
                        write_or_die(fd, hdr, 4);
                }
                write_or_die(fd, p, n);