From 1d54058911545a1d9a98ba9a6ad1f20126517540 Mon Sep 17 00:00:00 2001 From: edd Date: Tue, 6 Sep 2011 21:33:39 +0000 Subject: [PATCH] fix a possible segfault due to dereference of a NULL pointer --- audio/hgd/Makefile | 3 ++- audio/hgd/patches/patch-hgd-netd_c | 34 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 audio/hgd/patches/patch-hgd-netd_c diff --git a/audio/hgd/Makefile b/audio/hgd/Makefile index 3b487038274..eac993fa346 100644 --- a/audio/hgd/Makefile +++ b/audio/hgd/Makefile @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile,v 1.5 2011/07/25 23:07:49 edd Exp $ +# $OpenBSD: Makefile,v 1.6 2011/09/06 21:33:39 edd Exp $ COMMENT = music system for hackathons DISTNAME = hgd-0.4.1 +REVISION = 0 CATEGORIES = audio net HOMEPAGE = https://github.com/vext01/hgd/ diff --git a/audio/hgd/patches/patch-hgd-netd_c b/audio/hgd/patches/patch-hgd-netd_c new file mode 100644 index 00000000000..85397ef5497 --- /dev/null +++ b/audio/hgd/patches/patch-hgd-netd_c @@ -0,0 +1,34 @@ +$OpenBSD: patch-hgd-netd_c,v 1.1 2011/09/06 21:33:40 edd Exp $ + +Fix for #77, seg fault when a client attempts to queue without being logged in. + +--- hgd-netd.c.orig Sun Jul 24 18:29:43 2011 ++++ hgd-netd.c Sat Aug 27 22:51:01 2011 +@@ -303,6 +303,13 @@ hgd_cmd_queue(struct hgd_session *sess, char **args) + ssize_t write_ret; + char *filename, *tag_artist, *tag_title; + ++ if (sess->user == NULL) { ++ hgd_sock_send_line(sess->sock_fd, sess->ssl, ++ "err|user_not_identified"); ++ ret = HGD_FAIL; ++ goto clean; ++ } ++ + if ((flood_limit >= 0) && + (hgd_num_tracks_user(sess->user->name) >= flood_limit)) { + +@@ -320,13 +327,6 @@ hgd_cmd_queue(struct hgd_session *sess, char **args) + if ((bytes == 0) || ((long int) bytes > max_upload_size)) { + DPRINTF(HGD_D_WARN, "Incorrect file size"); + hgd_sock_send_line(sess->sock_fd, sess->ssl, "err|size"); +- ret = HGD_FAIL; +- goto clean; +- } +- +- if (sess->user == NULL) { +- hgd_sock_send_line(sess->sock_fd, sess->ssl, +- "err|user_not_identified"); + ret = HGD_FAIL; + goto clean; + }