s3-printing: fix format-truncation in print_queue_update()
authorGünther Deschner <gd@samba.org>
Tue, 8 May 2018 11:46:11 +0000 (13:46 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 17 May 2018 15:30:09 +0000 (17:30 +0200)
../source3/printing/printing.c: In function ‘print_queue_update’:
../source3/printing/printing.c:1809:42: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 244 [-Werror=format-truncation=]
  snprintf(key, sizeof(key), "MSG_PENDING/%s", sharename);
                                          ^~   ~~~~~~~~~
../source3/printing/printing.c:1809:2: note: ‘snprintf’ output between 13 and 268 bytes into a destination of size 256
  snprintf(key, sizeof(key), "MSG_PENDING/%s", sharename);

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/printing/printing.c

index d8124686302cfdea7c90af13e8e1227205d19cf5..0acbb7e28ced2f2edad28e30f3427d357aeadfa9 100644 (file)
@@ -1700,7 +1700,7 @@ extern pid_t background_lpq_updater_pid;
 static void print_queue_update(struct messaging_context *msg_ctx,
                               int snum, bool force)
 {
-       fstring key;
+       char key[268];
        fstring sharename;
        char *lpqcommand = NULL;
        char *lprmcommand = NULL;